當前位置: 首頁>>代碼示例>>Java>>正文


Java JScrollPane.setViewportView方法代碼示例

本文整理匯總了Java中javax.swing.JScrollPane.setViewportView方法的典型用法代碼示例。如果您正苦於以下問題:Java JScrollPane.setViewportView方法的具體用法?Java JScrollPane.setViewportView怎麽用?Java JScrollPane.setViewportView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.swing.JScrollPane的用法示例。


在下文中一共展示了JScrollPane.setViewportView方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: ListPanel

import javax.swing.JScrollPane; //導入方法依賴的package包/類
public ListPanel(FilterModel fltrmodel, Function<T, String> mapper) {
    setLayout(new java.awt.BorderLayout());
    JScrollPane sp = new javax.swing.JScrollPane();
    list = new JList();
    list.setModel(fltrmodel);
    list.setCellRenderer(new CheckBoxListRenderer(mapper));
    sp.setViewportView(list);
    add(sp, BorderLayout.CENTER);
    list.setSelectionModel(new MultiSelectionModel(this::onSelect));
    list.addKeyListener(onDelete());
    list.getInputMap(JComponent.WHEN_FOCUSED).put(KeyStroke.getKeyStroke("ctrl A"), "SelectAll");
    list.getActionMap().put("SelectAll", new AbstractAction() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            list.setSelectionInterval(0, list.getModel().getSize() - 1);
        }
    });
}
 
開發者ID:CognizantQAHub,項目名稱:Cognizant-Intelligent-Test-Scripter,代碼行數:19,代碼來源:JSList.java

示例2: createAndShowGUI

import javax.swing.JScrollPane; //導入方法依賴的package包/類
private static void createAndShowGUI() {
    frame = new JFrame();
    final JScrollPane jScrollPane1 = new JScrollPane();
    ta = new JTextArea();

    ta.setEditable(false);
    ta.setColumns(20);
    ta.setRows(5);
    jScrollPane1.setViewportView(ta);
    frame.add(ta);

    frame.pack();
    frame.setLocationRelativeTo(null);
    frame.setVisible(true);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:16,代碼來源:TextViewOOM.java

示例3: erzeugeMedienAnzeiger

import javax.swing.JScrollPane; //導入方法依賴的package包/類
/**
 * Erzeugt das Panel in dem die Mediendetails angezeigt werden.
 */
private void erzeugeMedienAnzeiger()
{
    JScrollPane medienAnzeigerScrollPane = new JScrollPane();
    medienAnzeigerScrollPane.setPreferredSize(new Dimension(-1, 160));
    medienAnzeigerScrollPane.setSize(-1, -1);
    medienAnzeigerScrollPane.setBorder(BorderFactory.createTitledBorder(
            null, "Ausgewählte Medien", TitledBorder.LEADING,
            TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
    medienAnzeigerScrollPane.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _medienAnzeigerTextArea = new JTextArea();
    _medienAnzeigerTextArea.setBackground(UIConstants.BACKGROUND_COLOR);
    medienAnzeigerScrollPane.setViewportView(_medienAnzeigerTextArea);
    _medienAnzeigerTextArea.setEditable(false);
    _medienAnzeigerTextArea.setFont(UIConstants.TEXT_FONT);

    _hauptPanel.add(medienAnzeigerScrollPane, BorderLayout.CENTER);
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:26,代碼來源:MedienDetailAnzeigerUI.java

示例4: createColumnViewArea

import javax.swing.JScrollPane; //導入方法依賴的package包/類
private JScrollPane createColumnViewArea()
{
    JScrollPane scroll_colEdit = new JScrollPane();
    scroll_colEdit.setViewportView(m_tblColView);
    scroll_colEdit.setBounds(m_scrollTblName.getWidth() + GuiConstants.GAP_COMPONENT, m_nYOffsetInRightPane,
                             s_nRightPaneWidth, 300);

    m_nYOffsetInRightPane += (scroll_colEdit.getHeight() + GuiConstants.GAP_COMPONENT);

    return scroll_colEdit;
}
 
開發者ID:s-store,項目名稱:sstore-soft,代碼行數:12,代碼來源:TableGui.java

示例5: createUserPanel

import javax.swing.JScrollPane; //導入方法依賴的package包/類
private JComponent createUserPanel() {
    JScrollPane pane = new JScrollPane();
    userTable = new JTable(userModel) {
        /**
         *
         */
        private static final long serialVersionUID = 2660594023797090389L;


        public void changeSelection(int rowIndex, int columnIndex,
                                    boolean toggle, boolean extend) {
            super.changeSelection(rowIndex, columnIndex, toggle, extend);
            groupModel.fireTableDataChanged();
            qualifierModel.fireTableDataChanged();
            deleteUser.setEnabled(rowIndex >= 0);
            editUser.setEnabled(rowIndex >= 0);
        }
    };
    pane.setViewportView(userTable);
    return pane;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:22,代碼來源:EditUsersDialog.java

示例6: TextPanel

import javax.swing.JScrollPane; //導入方法依賴的package包/類
/**
 * Create the panel.
 */
public TextPanel(String text) {
	
	JLabel lblUpdateChangelog = new JLabel("Update description/change-log:");
	
	JScrollPane scrollPane = new JScrollPane();
	
	JLabel lblDoYouWant = new JLabel("Do you want to install this update?");
	lblDoYouWant.setFont(new Font("Tahoma", Font.PLAIN, 15));
	lblDoYouWant.setHorizontalAlignment(SwingConstants.CENTER);
	GroupLayout groupLayout = new GroupLayout(this);
	groupLayout.setHorizontalGroup(
	    groupLayout.createParallelGroup(Alignment.TRAILING)
	        .addGroup(groupLayout.createSequentialGroup()
	            .addContainerGap()
	            .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
	                .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
	                .addComponent(lblUpdateChangelog, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE)
	                .addComponent(lblDoYouWant, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 430, Short.MAX_VALUE))
	            .addContainerGap())
	);
	groupLayout.setVerticalGroup(
	    groupLayout.createParallelGroup(Alignment.LEADING)
	        .addGroup(groupLayout.createSequentialGroup()
	            .addContainerGap()
	            .addComponent(lblUpdateChangelog)
	            .addPreferredGap(ComponentPlacement.RELATED)
	            .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 249, Short.MAX_VALUE)
	            .addPreferredGap(ComponentPlacement.RELATED)
	            .addComponent(lblDoYouWant)
	            .addContainerGap())
	);
	
	JTextArea textArea = new JTextArea();
	scrollPane.setViewportView(textArea);
	setLayout(groupLayout);
	textArea.setEditable(false);
	textArea.setText(text);

}
 
開發者ID:mob41,項目名稱:osumer,代碼行數:43,代碼來源:TextPanel.java

示例7: createTable

import javax.swing.JScrollPane; //導入方法依賴的package包/類
private Component createTable() {
    JScrollPane pane = new JScrollPane();
    tableModel = new Model();
    table = new JTable(tableModel);
    pane.setViewportView(table);
    return pane;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:8,代碼來源:MainFrame.java

示例8: erzeugeVerleihkartenauflister

import javax.swing.JScrollPane; //導入方法依賴的package包/類
/**
 * Erzeuge das Tabellen-Panel, in dem die Verleihkarten angezeigt werden.
 */
private void erzeugeVerleihkartenauflister()
{
    JPanel verleihkartenAuflisterPanel = new JPanel();
    _hauptPanel.add(verleihkartenAuflisterPanel, BorderLayout.CENTER);
    verleihkartenAuflisterPanel.setLayout(new BorderLayout());
    verleihkartenAuflisterPanel
        .setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAuflisterPanel.setSize(-1, -1);
    verleihkartenAuflisterPanel.setBackground(UIConstants.BACKGROUND_COLOR);

    JScrollPane verleihkartenAuflisterScrollPane = new JScrollPane();
    verleihkartenAuflisterPanel.add(verleihkartenAuflisterScrollPane,
            BorderLayout.CENTER);
    verleihkartenAuflisterScrollPane
        .setPreferredSize(new java.awt.Dimension(-1, -1));
    verleihkartenAuflisterScrollPane.setSize(-1, -1);
    verleihkartenAuflisterScrollPane.setBorder(BorderFactory
        .createTitledBorder(null, "Verleihkarten", TitledBorder.LEADING,
                TitledBorder.DEFAULT_POSITION, UIConstants.HEADER_FONT));
    verleihkartenAuflisterScrollPane
        .setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAuflisterScrollPane.getVerticalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);
    verleihkartenAuflisterScrollPane.getHorizontalScrollBar()
        .setBackground(UIConstants.BACKGROUND_COLOR);

    _verleihkartenAuflisterTableModel = new VerleihkartenTableModel();
    _verleihkartenAuflisterTable = new JTable();
    verleihkartenAuflisterScrollPane
        .setViewportView(_verleihkartenAuflisterTable);
    _verleihkartenAuflisterTable
        .setModel(_verleihkartenAuflisterTableModel);
    JTableHeader tableHeader = _verleihkartenAuflisterTable
        .getTableHeader();
    tableHeader.setFont(UIConstants.HEADER_FONT);
    tableHeader.setReorderingAllowed(false);
    tableHeader.setResizingAllowed(false);
    _verleihkartenAuflisterTable.setFont(UIConstants.TEXT_FONT);
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:43,代碼來源:RueckgabeUI.java

示例9: loadScene

import javax.swing.JScrollPane; //導入方法依賴的package包/類
@Override
public void loadScene(Container container) {
	JScrollPane scrollPane = new JScrollPane();
	scrollPane.setBounds(0, 0, 784, 461);
	container.add(scrollPane);

	JTextPane textPane = new JTextPane();
	textPane.setFont(new Font("Tahoma", Font.PLAIN, 12));
	for (int i = 0; i < 50; i++) {
		textPane.setText(textPane.getText() + "\n" + i);
	}
	scrollPane.setViewportView(textPane);
}
 
開發者ID:Cyphereion,項目名稱:Java-Swing-Helper,代碼行數:14,代碼來源:SceneText.java

示例10: deleteElements

import javax.swing.JScrollPane; //導入方法依賴的package包/類
public static boolean deleteElements(DeleteStatusList list,
                                     JComponent component, GUIFramework framework) {

    final JLabel label = new JLabel(toMessage(list, framework));
    final JScrollPane pane = new JScrollPane();
    pane.setBorder(null);
    pane.setViewportView(label);
    final Dimension d = label.getPreferredSize();
    final Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
    boolean b = false;
    if (d.width >= screen.width * 0.7) {
        d.width = (int) (screen.width * 0.7);
        b = true;
    } else
        d.width += 20;
    if (d.height >= screen.height / 2) {
        d.height = screen.height / 2;
        b = true;
    } else
        d.height += 20;
    if (b)
        pane.setPreferredSize(d);

    int r = JOptionPane.showOptionDialog(component, new Object[]{
                    pane,
                    new JLabel(GlobalResourcesManager
                            .getString("DeleteActiveElementsDialog.Warning"))},
            GlobalResourcesManager.getString("ConfirmMessage.Title"),
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null,
            null, null);

    if (JOptionPane.YES_OPTION == r) {
        return true;
    }
    return false;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:37,代碼來源:StatusMessageFormat.java

示例11: SelectBaseFunctionDialog

import javax.swing.JScrollPane; //導入方法依賴的package包/類
public SelectBaseFunctionDialog(GUIFramework framework) {
    super(framework.getMainFrame(), true);
    setTitle(GlobalResourcesManager.getString("SelectModel"));
    result = null;
    final List<Qualifier> base = IDEF0Plugin.getBaseQualifiers(framework
            .getEngine());
    Collections.sort(base, new Comparator<Qualifier>() {

        private Collator collator = Collator.getInstance();

        @Override
        public int compare(Qualifier o1, Qualifier o2) {
            return collator.compare(o1.getName(), o2.getName());
        }
    });
    list.setModel(new AbstractListModel() {

        @Override
        public Object getElementAt(int index) {
            return base.get(index);
        }

        @Override
        public int getSize() {
            return base.size();
        }

    });

    JScrollPane pane = new JScrollPane();
    pane.setViewportView(list);
    setMainPane(pane);
    pack();
    setMinimumSize(getSize());
    setLocationRelativeTo(null);
    Options.loadOptions(this);
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:38,代碼來源:SelectBaseFunctionDialog.java

示例12: TypeWizard

import javax.swing.JScrollPane; //導入方法依賴的package包/類
/**
 * Create the frame.
 */
public TypeWizard(final Graph graph, final Object onWhat, final List<Object> list) {
  this.graph = graph;
  this.onWhat = onWhat;

  this.setTitle("Change Atom Type Wizard");
  this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  this.setBounds(100, 100, 450, 300);
  this.getContentPane().setLayout(new BorderLayout(0, 0));

  final JScrollPane scrollPane = new JScrollPane();
  this.getContentPane().add(scrollPane, BorderLayout.CENTER);

  this.list = new JList<Object>();
  this.list.setFont(new Font("Times New Roman", Font.PLAIN, 12));
  this.list.setBorder(new LineBorder(new Color(0, 0, 0)));
  this.list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  this.list.setModel(new TypeListModel(list));
  scrollPane.setViewportView(this.list);

  final JPanel buttonPanel = new JPanel();
  this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
  buttonPanel.setLayout(new BorderLayout(0, 0));

  this.finishButton = new JButton("Finish");
  this.finishButton.setFont(new Font("Times New Roman", Font.PLAIN, 12));
  this.finishButton.setMnemonic('F');
  buttonPanel.add(this.finishButton, BorderLayout.EAST);

  this.finishButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(final ActionEvent arg) {
      TypeWizard.this.performFinish();
      GraphUtil.getInstance().layout();
      TypeWizard.this.dispose();
    }
  });
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:41,代碼來源:TypeWizard.java

示例13: Ouners

import javax.swing.JScrollPane; //導入方法依賴的package包/類
public Ouners() {
    setLayout(new BorderLayout());
    final JScrollPane pane = new JScrollPane();
    final JTable table = new JTable(model);
    pane.setViewportView(table);
    this.add(pane, BorderLayout.CENTER);
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:8,代碼來源:NewProjectDialog.java

示例14: createGUIPluginListComponent

import javax.swing.JScrollPane; //導入方法依賴的package包/類
private Component createGUIPluginListComponent() {
    JScrollPane pane = new JScrollPane();
    Object[][] data = new Object[guiPlugins.size()][];
    for (int i = 0; i < guiPlugins.size(); i++) {
        GUIPlugin plugin = guiPlugins.get(i);
        String name = plugin.getName();
        if (plugin instanceof com.ramussoft.gui.common.AttributePlugin)
            name = "Attribute."
                    + name
                    + "."
                    + ((com.ramussoft.gui.common.AttributePlugin) plugin)
                    .getAttributeType().getTypeName();
        data[i] = new Object[]{name};
    }

    Arrays.sort(data, new Comparator<Object[]>() {

        @SuppressWarnings("unchecked")
        @Override
        public int compare(Object[] o1, Object[] o2) {
            return ((Comparable<String>) o1[0]).compareTo((String) o2[0]);
        }

    });

    DefaultTableModel model = new DefaultTableModel(
            data,
            new Object[]{GlobalResourcesManager.getString("Plugin.Name")}) {
        /**
         *
         */
        private static final long serialVersionUID = 4893341040484525590L;

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    pane.setViewportView(new JTable(model));
    return pane;
}
 
開發者ID:Vitaliy-Yakovchuk,項目名稱:ramus,代碼行數:42,代碼來源:AboutDialog.java

示例15: RecogApp

import javax.swing.JScrollPane; //導入方法依賴的package包/類
public RecogApp()
{
	super("Card Recognizer");
	BorderLayout bl = new BorderLayout();
	setLayout(bl);

	list = new RecogList();

	setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	Webcam w = WebcamUtils.chooseWebcam();

	JPanel right = new JPanel();
	right.setLayout(new GridLayout(2,1));

	wc = new WebcamCanvas(w);

	JScrollPane scroll = new JScrollPane();
	select = new SetLoadPanel(list);
	scroll.setViewportView(select);
	add(wc,BorderLayout.CENTER);
	add(right,BorderLayout.EAST);
	right.add(new SettingsPanel());
	right.add(scroll);
	right.setPreferredSize(new Dimension(300,wc.getHeight()));
	pack();
	setVisible(true);
	setResizable(false);
	try{
		w.open();
	}catch(WebcamLockException e)
	{
		JOptionPane.showMessageDialog(null, "Webcam already in use. Exiting.");
		System.exit(0);
	}
	wc.getCanvas().addKeyListener(this);
	while(true)
	{
		wc.draw();
		if(SettingsPanel.RECOG_EVERY_FRAME)
		{
			doRecog();
		}
	}
}
 
開發者ID:ForOhForError,項目名稱:MTG-Card-Recognizer,代碼行數:45,代碼來源:RecogApp.java


注:本文中的javax.swing.JScrollPane.setViewportView方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。