Java Code Examples for java.awt.ScrollPane#add()
The following examples show how to use
java.awt.ScrollPane#add() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: arffTransferNodeView.java From ETL_Unicorn with Apache License 2.0 | 6 votes |
public void view(){ scrollPane = new ScrollPane(); panel=new Panel(); panel.setBackground(Color.yellow); // JScrollPane j=new JScrollPane(); tableout.setBackground(new Color(240, 128, 128)); tableout.setPreferredSize(new Dimension(200,200)); tableout.setVisible(true); j.setViewportView(tableout); // panel.add(j); scrollPane.add(panel); add(scrollPane); close=false; }
Example 2
Source File: VncClient.java From cosmic with Apache License 2.0 | 6 votes |
private Frame createVncClientMainWindow(final BufferedImageCanvas canvas, final String title) { // Create AWT windows final Frame frame = new Frame(title + " - VNCle"); // Use scrolling pane to support screens, which are larger than ours final ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); scroller.add(canvas); scroller.setSize(this.screen.getFramebufferWidth(), this.screen.getFramebufferHeight()); frame.add(scroller); frame.pack(); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(final WindowEvent evt) { frame.setVisible(false); shutdown(); } }); return frame; }
Example 3
Source File: PvExplorer.java From AndrOBD with GNU General Public License v3.0 | 6 votes |
@Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) { // find the process var to selected row ... ProcessVar pv = pvTable.getPvModel().getElementAt(pvTable.getSelectedRow()); // and show a detail panel about it ... if (pv != null) { PvDetailPanel panDetail = new PvDetailPanel(pv, true); ScrollPane panScr = new ScrollPane(); panScr.setPreferredSize(new Dimension(640, 480)); panScr.add(panDetail); JOptionPane.showMessageDialog(null, panScr); } } }
Example 4
Source File: Client.java From cloudstack with Apache License 2.0 | 6 votes |
protected static Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title, WindowListener windowListener) { // Create AWT windows Frame frame = new Frame(title + " - RDP"); // Use scrolling pane to support screens, which are larger than ours scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); scroller.add(canvas); scroller.setSize(canvas.getWidth(), canvas.getHeight()); frame.add(scroller); frame.pack(); frame.setVisible(true); frame.addWindowListener(windowListener); return frame; }
Example 5
Source File: VncClient.java From cloudstack with Apache License 2.0 | 6 votes |
private Frame createVncClientMainWindow(BufferedImageCanvas canvas, String title) { // Create AWT windows final Frame frame = new Frame(title + " - VNCle"); // Use scrolling pane to support screens, which are larger than ours ScrollPane scroller = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED); scroller.add(canvas); scroller.setSize(screen.getFramebufferWidth(), screen.getFramebufferHeight()); frame.add(scroller); frame.pack(); frame.setVisible(true); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent evt) { frame.setVisible(false); shutdown(); } }); return frame; }
Example 6
Source File: MidiCommunication.java From jmg with GNU General Public License v2.0 | 6 votes |
private void fillFrame(Frame f, List dataList, MidiDevice.Info[] info) { try { f.setSize(340, 200); f.setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - 170, Toolkit.getDefaultToolkit().getScreenSize().height / 2 - 100); String[] data = new String[info.length]; data[0] = "" + info[0]; data[1] = "" + info[1]; for(int i=2; i< info.length; i++) { data[i] = MidiSystem.getMidiDevice(info[i]).toString(); } for(int i=0; i< info.length; i++) { dataList.add(data[i]); } ScrollPane scrollPane = new ScrollPane(); scrollPane.add(dataList); f.add(scrollPane); } catch (Exception e) { System.out.println (e); System.exit (0); } }
Example 7
Source File: arffTransferNodePanel.java From ETL_Unicorn with Apache License 2.0 | 5 votes |
public arffTransferNodePanel(final arffTransferNodeRun thisRun){ setLayout(null); scrollPane = new ScrollPane(); add(scrollPane); panel= new Panel(); panel.setLayout(null); panel.setBackground(Color.white); JButton button= new JButton("Finish"); button.setBounds(0, 0, 100, 30); button.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ System.out.println(e.getSource()); close=true; thisRun.value=1; //���isConfiged���д�������Ϊ����һ������ִ�е��жϹؼ��֣�һ�������óɹ��Ž��и�ֵ��20190622 //this.isConfiged= true; } }); panel.add(button); JButton readfile= new JButton("Write File"); readfile.setBounds(0, 35, 100, 65); readfile.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent arg0) { filedialog=new FileDialog(new Frame(),"filechoose",FileDialog.LOAD); filedialog.setVisible(true); thisRun.filepath=filedialog.getDirectory()+filedialog.getFile(); System.out.println(thisRun.filepath); } }); panel.add(readfile); scrollPane.add(panel); close= false; }
Example 8
Source File: ScrollPaneValidateTest.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public ScrollPaneValidateTest() { setBounds(300, 300, 300, 300); pane = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); add(pane, BorderLayout.NORTH); pane.add(new InnerPanel()); }
Example 9
Source File: ScrollPaneValidateTest.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
public ScrollPaneValidateTest() { setBounds(300, 300, 300, 300); pane = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); add(pane, BorderLayout.NORTH); pane.add(new InnerPanel()); }
Example 10
Source File: ScrollPaneValidateTest.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public ScrollPaneValidateTest() { setBounds(300, 300, 300, 300); pane = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); add(pane, BorderLayout.NORTH); pane.add(new InnerPanel()); }
Example 11
Source File: PrinterAttributes.java From cups4j with GNU Lesser General Public License v3.0 | 4 votes |
private Component gatAttributeTab(AttributeGroup group) { JPanel jp = new JPanel(new BorderLayout()); ScrollPane scp = new ScrollPane(); jp.add(scp, BorderLayout.CENTER); FormLayout layout = new FormLayout("12dlu, pref, 6dlu, 30dlu:grow, 3dlu"); DefaultFormBuilder builder = new DefaultFormBuilder(layout); builder.setLeadingColumnOffset(1); Collections.sort(group.getAttribute(), new Comparator<Attribute>() { @Override public int compare(Attribute a1, Attribute a2) { return a1.getName().compareTo(a2.getName()); } }); for (Attribute att : group.getAttribute()) { JComponent valueComponent = null; if (att.getAttributeValue().size() > 0) { JPanel panel = new JPanel(new BorderLayout()); AttributeValueTable table = new AttributeValueTable((getAttributeTableModel(att .getAttributeValue()))); panel.add(table.getTableHeader(), BorderLayout.NORTH); panel.add(table, BorderLayout.CENTER); valueComponent = panel; } else { JLabel lb = new JLabel("no value reported"); lb.setForeground(Color.red); valueComponent = lb; } builder.appendSeparator(); builder.append(att.getName(), valueComponent); builder.nextLine(); } scp.add(builder.getPanel()); return jp; }
Example 12
Source File: ScrollPaneValidateTest.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
public ScrollPaneValidateTest() { setBounds(300, 300, 300, 300); pane = new ScrollPane(ScrollPane.SCROLLBARS_NEVER); add(pane, BorderLayout.NORTH); pane.add(new InnerPanel()); }
Example 13
Source File: GUIHelper.java From SPIM_Registration with GNU General Public License v2.0 | 4 votes |
/** * A copy of Curtis's method * * https://github.com/openmicroscopy/bioformats/blob/v4.4.8/components/loci-plugins/src/loci/plugins/util/WindowTools.java#L72 * * * @param pane */ public static void addScrollBars(Container pane) { // * <dependency> // * <groupId>${bio-formats.groupId}</groupId> // * <artifactId>loci_plugins</artifactId> // * <version>${bio-formats.version}</version> // * </dependency> GridBagLayout layout = (GridBagLayout) pane.getLayout(); // extract components int count = pane.getComponentCount(); Component[] c = new Component[count]; GridBagConstraints[] gbc = new GridBagConstraints[count]; for (int i = 0; i < count; i++) { c[i] = pane.getComponent(i); gbc[i] = layout.getConstraints(c[i]); } // clear components pane.removeAll(); layout.invalidateLayout(pane); // create new container panel Panel newPane = new Panel(); GridBagLayout newLayout = new GridBagLayout(); newPane.setLayout(newLayout); for (int i = 0; i < count; i++) { newLayout.setConstraints(c[i], gbc[i]); newPane.add(c[i]); } // HACK - get preferred size for container panel // NB: don't know a better way: // - newPane.getPreferredSize() doesn't work // - newLayout.preferredLayoutSize(newPane) doesn't work Frame f = new Frame(); f.setLayout(new BorderLayout()); f.add(newPane, BorderLayout.CENTER); f.pack(); final Dimension size = newPane.getSize(); f.remove(newPane); f.dispose(); // compute best size for scrollable viewport size.width += 25; size.height += 15; Dimension screen = Toolkit.getDefaultToolkit().getScreenSize(); int maxWidth = 7 * screen.width / 8; int maxHeight = 3 * screen.height / 4; if (size.width > maxWidth) size.width = maxWidth; if (size.height > maxHeight) size.height = maxHeight; // create scroll pane ScrollPane scroll = new ScrollPane() { private static final long serialVersionUID = 1L; public Dimension getPreferredSize() { return size; } }; scroll.add(newPane); // add scroll pane to original container GridBagConstraints constraints = new GridBagConstraints(); constraints.gridwidth = GridBagConstraints.REMAINDER; constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1.0; constraints.weighty = 1.0; layout.setConstraints(scroll, constraints); pane.add(scroll); }