List of usage examples for javax.swing JScrollPane setViewportView
public void setViewportView(Component view)
From source file:com.att.aro.ui.view.menu.file.BPVideoWarnFailPanel.java
private Component getGridPanel() { JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(getTable()); int height = 70; if (Util.isWindowsOS()) { height = 78;/*from ww w.j a v a 2 s . com*/ } scrollPane.setPreferredSize(new Dimension(550, height)); return scrollPane; }
From source file:Demo.HistGraph.java
public HistGraph(List<String> paraType_list) { this.paraType_list = paraType_list; // widgets: charts(JFreeChart), parameter selector (JList) chartPane = new ChartPanel(null); charts = new JFreeChart[paraType_list.size()]; DefaultListModel modelOfList = new DefaultListModel(); paraSelector = new JList(modelOfList); for (int i = 0; i < paraType_list.size(); i++) { modelOfList.addElement(paraType_list.get(i)); charts[i] = null;//from w w w .j a va 2 s. c o m } paraSelector.setSelectedIndex(0); charts[0] = CreateChart(paraType_list.get(0)); chartPane.setChart(charts[0]); JScrollPane selectorPanel = new JScrollPane(); selectorPanel.setViewportView(paraSelector); paraSelector.addMouseListener(this); // layout GridBagLayout layout = new GridBagLayout(); setLayout(layout); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.weighty = 1; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(5, 20, 5, 5); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 20; add(new JLabel("Distribution:"), gbc); gbc.insets = new Insets(5, 5, 5, 20); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 1; add(new JLabel("Parameters:"), gbc); gbc.weighty = 14; gbc.insets = new Insets(5, 20, 5, 5); gbc.gridx = 0; gbc.gridy = 1; gbc.weightx = 20; add(chartPane, gbc); gbc.insets = new Insets(5, 5, 15, 20); gbc.gridx = 1; gbc.gridy = 1; gbc.weightx = 1; add(selectorPanel, gbc); }
From source file:net.sf.firemox.ui.wizard.AboutMdb.java
/** * Creates a new instance of AboutMdb <br> * /*from w w w.j a v a 2 s .co m*/ * @param parent */ public AboutMdb(JFrame parent) { super(LanguageManager.getString("about.tbs"), "<html><b>" + LanguageManager.getString("tbsname") + ": </b>" + MdbLoader.getTbsFullName() + "<br><b>" + LanguageManager.getString("author") + ": </b>" + MdbLoader.getAuthor() + "<br><b>" + LanguageManager.getString("info") + ": </b>" + MdbLoader.getMoreInfo() + "<br><b>" + LanguageManager.getString("version") + ": </b>" + MdbLoader.getVersion(), "mp64.gif", LanguageManager.getString("close"), 420, 320); JTextArea disclaimer = new JTextArea(); disclaimer.setEditable(false); disclaimer.setLineWrap(true); disclaimer.setWrapStyleWord(true); disclaimer.setAutoscrolls(true); // Then try and read it locally final InputStream inGPL = MToolKit.getResourceAsStream(MToolKit.mdbFile); if (inGPL != null) { disclaimer.setText(MdbLoader.getDisclaimer().replaceAll("\t", "").replaceAll("\n", "")); IOUtils.closeQuietly(inGPL); } JScrollPane disclaimerSPanel = new JScrollPane(); disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(disclaimerSPanel); disclaimerSPanel.setViewportView(disclaimer); gameParamPanel.add(disclaimerSPanel); setLocation((getToolkit().getScreenSize().width - 420) / 2, (getToolkit().getScreenSize().height - 320) / 2); }
From source file:hu.bme.mit.sette.snippetbrowser.SnippetBrowser.java
/** * Initialise the contents of the frame. *//*from w w w .j av a 2s. com*/ private void initialize() { setTitle("Snippet Browser"); this.setBounds(50, 50, 1000, 600); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JSplitPane splitPane = new JSplitPane(); splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.setResizeWeight(0.3); getContentPane().add(splitPane, BorderLayout.CENTER); JScrollPane scrollPaneLeft = new JScrollPane(); splitPane.setLeftComponent(scrollPaneLeft); treeSnippets = new JTree(); scrollPaneLeft.setViewportView(treeSnippets); JScrollPane scrollPaneRight = new JScrollPane(); splitPane.setRightComponent(scrollPaneRight); txtrInfo = new JTextArea(); txtrInfo.setEditable(false); scrollPaneRight.setViewportView(txtrInfo); }
From source file:Demo.ScatterGraph.java
public ScatterGraph(int sampleNb, List<String> paraType_list) { this.sampleNb = sampleNb; this.paraType_list = paraType_list; // widgets: charts(JFreeChart), parameter selectors (JList) DefaultListModel xModel = new DefaultListModel(); xSelector = new JList(xModel); JScrollPane xSelPane = new JScrollPane(); xSelPane.setViewportView(xSelector); DefaultListModel yModel = new DefaultListModel(); ySelector = new JList(yModel); JScrollPane ySelPane = new JScrollPane(); ySelPane.setViewportView(ySelector); charts = new JFreeChart[paraType_list.size()][paraType_list.size()]; for (int i = 0; i < paraType_list.size(); i++) { String para = paraType_list.get(i); xModel.addElement(para);//from ww w . j av a 2s. c o m yModel.addElement(para); for (int j = 0; j < paraType_list.size(); j++) { charts[i][j] = null; } } charts[0][0] = CreateChart(0, 0); chartPane = new ChartPanel(charts[0][0]); xSelector.setSelectedIndex(0); ySelector.setSelectedIndex(0); xSelector.addMouseListener(this); ySelector.addMouseListener(this); // layout GridBagLayout layout = new GridBagLayout(); setLayout(layout); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.WEST; gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(5, 20, 5, 5); gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 20; gbc.weighty = 12; gbc.gridheight = 4; add(chartPane, gbc); gbc.insets = new Insets(5, 5, 5, 20); gbc.gridx = 1; gbc.weightx = 1; gbc.gridheight = 1; gbc.gridy = 0; gbc.weighty = 1; add(new JLabel("X :"), gbc); gbc.gridy = 2; add(new JLabel("Y :"), gbc); gbc.gridy = 1; gbc.weighty = 5; add(xSelPane, gbc); gbc.gridy = 3; add(ySelPane, gbc); }
From source file:kenh.xscript.elements.Debug.java
private void initial(Container c) { c.setLayout(new BorderLayout()); // Add variable list DefaultListModel<String> model = new DefaultListModel(); if (this.getEnvironment() != null) { java.util.Set<String> keys = this.getEnvironment().getVariables().keySet(); for (String key : keys) { model.addElement(key);/*from w w w . ja v a2 s. co m*/ } } else { for (int i = 1; i < 10; i++) { model.addElement("Variable " + i); } model.addElement("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } JList list = new JList(model); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane listPane = new JScrollPane(); listPane.setViewportView(list); listPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); c.add(listPane, BorderLayout.EAST); list.setPreferredSize(new Dimension(150, list.getPreferredSize().height)); // JTextField quote = new JTextField(); quote.requestFocus(); //JButton button = new JButton(">>"); JPanel quotePanel = new JPanel(); quotePanel.setLayout(new BorderLayout()); quotePanel.add(quote, BorderLayout.CENTER); //quotePanel.add(button, BorderLayout.EAST); JTextArea result = new JTextArea(); result.setEditable(false); JScrollPane resultPane = new JScrollPane(); resultPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); resultPane.setViewportView(result); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add(quotePanel, BorderLayout.NORTH); panel.add(resultPane, BorderLayout.CENTER); c.add(panel, BorderLayout.CENTER); list.addListSelectionListener(this); //button.addActionListener(this); quote.addKeyListener(this); this.result = result; }
From source file:com.moss.appprocs.swing.ProgressMonitorPanel.java
/** * @param useScrollpane If true, the panel which holds the ProgressMonitorBeanS will be embedded in a JSrollPane *///www . j a v a2 s. c om public ProgressMonitorPanel(boolean useScrollpane) { if (useScrollpane) { JScrollPane scrollpane = new JScrollPane(); setLayout(new BorderLayout()); add(scrollpane, BorderLayout.CENTER); scrollpane.setViewportView(monitorsPanel); monitorsPanel.setLayout(new GridBagLayout()); } else { setLayout(new BorderLayout()); add(monitorsPanel, BorderLayout.CENTER); monitorsPanel.setLayout(new GridBagLayout()); } }
From source file:fi.smaa.jsmaa.gui.JSMAAMainFrame.java
private void rebuildGUI() { JSplitPane splitPane = new JSplitPane(); splitPane.setResizeWeight(0.1);/*from w ww.j av a 2 s .c om*/ splitPane.setDividerSize(2); splitPane.setDividerLocation(-1); rightPane = new JScrollPane(); rightPane.getVerticalScrollBar().setUnitIncrement(16); splitPane.setRightComponent(rightPane); JScrollPane leftScrollPane = new JScrollPane(); leftScrollPane.setViewportView(guiFactory.getTree()); splitPane.setLeftComponent(leftScrollPane); getContentPane().removeAll(); getContentPane().setLayout(new BorderLayout()); getContentPane().add("Center", splitPane); getContentPane().add("North", guiFactory.getTopToolBar()); getContentPane().add("South", guiFactory.getBottomToolBar()); setJMenuBar(guiFactory.getMenuBar()); guiFactory.getTree().addTreeSelectionListener(new LeftTreeSelectionListener()); pack(); }
From source file:net.sf.firemox.ui.component.SplashScreen.java
/** * Create a new instance of this class./*from w w w .j a v a 2 s . c o m*/ * * @param filename * the picture filename. * @param parent * the splash screen's parent. * @param waitTime * the maximum time before the screen is hidden. */ public SplashScreen(String filename, Frame parent, int waitTime) { super(parent); getContentPane().setLayout(null); toFront(); final JLabel l = new JLabel(new ImageIcon(filename)); final Dimension labelSize = l.getPreferredSize(); l.setLocation(0, 0); l.setSize(labelSize); setSize(labelSize); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(screenSize.width / 2 - labelSize.width / 2, screenSize.height / 2 - labelSize.height / 2); final JLabel mp = new JLabel(IdConst.PROJECT_DISPLAY_NAME); mp.setLocation(30, 305); mp.setSize(new Dimension(300, 30)); final JLabel version = new JLabel(IdConst.VERSION); version.setLocation(235, 418); version.setSize(new Dimension(300, 30)); final JTextArea disclaimer = new JTextArea(); disclaimer.setEditable(false); disclaimer.setLineWrap(true); disclaimer.setWrapStyleWord(true); disclaimer.setAutoscrolls(true); disclaimer.setFont(MToolKit.defaultFont); disclaimer.setTabSize(2); // Then try and read it locally Reader inGPL = null; try { inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE))); disclaimer.read(inGPL, ""); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inGPL); } final JScrollPane disclaimerSPanel = new JScrollPane(); disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); disclaimerSPanel.setViewportView(disclaimer); disclaimerSPanel.setLocation(27, 340); disclaimerSPanel.setPreferredSize(new Dimension(283, 80)); disclaimerSPanel.setSize(disclaimerSPanel.getPreferredSize()); getContentPane().add(disclaimerSPanel); getContentPane().add(version); getContentPane().add(mp); getContentPane().add(l); final int pause = waitTime; final Runnable waitRunner = new Runnable() { public void run() { try { Thread.sleep(pause); while (!bKilled) { Thread.sleep(200); } } catch (InterruptedException e) { // Ignore this error } setVisible(false); dispose(); MagicUIComponents.magicForm.toFront(); } }; // setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { setVisible(false); dispose(); if (MagicUIComponents.magicForm != null) MagicUIComponents.magicForm.toFront(); } }); addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_SPACE) { setVisible(false); dispose(); MagicUIComponents.magicForm.toFront(); } } }); setVisible(true); start(waitRunner); }
From source file:net.brtly.monkeyboard.plugin.DeviceList.java
public DeviceList(PluginDelegate service) { super(service); setLayout(new MigLayout("inset 5", "[grow]", "[grow]")); JScrollPane scrollPane = new JScrollPane(); add(scrollPane, "cell 0 0,grow"); _table = new JTable(); scrollPane.setViewportView(_table); _model = new DeviceListModel(); _model.addTableModelListener(_table); _table.getSelectionModel().addListSelectionListener(new DeviceListListener()); _table.setModel(_model);/*from w w w . ja va2s . co m*/ _table.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN); _table.getColumnModel().getColumn(0).setMinWidth(24); _table.getColumnModel().getColumn(0).setMaxWidth(24); _table.getColumnModel().getColumn(1).setMinWidth(24); _table.getColumnModel().getColumn(1).setMaxWidth(300); _table.getColumnModel().getColumn(1).setPreferredWidth(150); // _table.getColumnModel().getColumn(2).setMinWidth(48); _table.getColumnModel().getColumn(2).setPreferredWidth(48); _table.getColumnModel().getColumn(2).setMaxWidth(96); getDelegate().getContext().getEventBus().register(_model); }