Java Code Examples for javax.swing.JScrollPane#createHorizontalScrollBar()
The following examples show how to use
javax.swing.JScrollPane#createHorizontalScrollBar() .
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: GridTableFrame.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Constructor GridTableFrame * @param griddata */ public GridTableFrame(GridData griddata) { setTitle("Grid-Data Table"); //$NON-NLS-1$ setSize(400, 300); this.griddata = griddata; int n = griddata.getComponentCount(); tables = new GridDataTable[n]; for(int i = 0; i<n; i++) { tables[i] = new GridDataTable(griddata, i); JScrollPane scrollpane = new JScrollPane(tables[i]); scrollpane.createHorizontalScrollBar(); if(n==1) { getContentPane().add(scrollpane, BorderLayout.CENTER); return; } tabbedPane.addTab(griddata.getComponentName(i), scrollpane); } getContentPane().add(tabbedPane, BorderLayout.CENTER); }
Example 2
Source File: OSPTableInspector.java From osp with GNU General Public License v3.0 | 6 votes |
private void createGUI() { setSize(400, 300); setContentPane(new JPanel(new BorderLayout())); JScrollPane scrollpane = new JScrollPane(table); scrollpane.createHorizontalScrollBar(); getContentPane().add(scrollpane, BorderLayout.CENTER); if(!JDialog.isDefaultLookAndFeelDecorated()) { return; } JPanel panel = new JPanel(new FlowLayout()); JButton closeButton = new JButton(ControlsRes.getString("OSPTableInspector.OK")); //$NON-NLS-1$ panel.add(closeButton); getContentPane().add(panel, BorderLayout.SOUTH); closeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setVisible(false); dispose(); } }); }
Example 3
Source File: XMLTableInspector.java From osp with GNU General Public License v3.0 | 6 votes |
/** * Sets the XMLTable. * * @return the table */ public void setTable(XMLTable xmlTable) { if(table!=null) { table.removePropertyChangeListener("cell", this); //$NON-NLS-1$ table.removePropertyChangeListener("tableData", this); //$NON-NLS-1$ xmlTable.setEditable(table.isEditable()); } table = xmlTable; // listen for "cell" changes in arrays table.addPropertyChangeListener("cell", this); //$NON-NLS-1$ // listen for "tableData" changes in the table table.addPropertyChangeListener("tableData", this); //$NON-NLS-1$ JScrollPane scrollpane = new JScrollPane(table); scrollpane.createHorizontalScrollBar(); getContentPane().add(scrollpane, BorderLayout.CENTER); }
Example 4
Source File: ArrayPanel.java From osp with GNU General Public License v3.0 | 5 votes |
/** * Creates the GUI. */ protected void createGUI() { this.removeAll(); // remove old elements Paco: be careful with this. If you use the ArrayPanel as a normal JPanel // and have added another component, it will be lost! this.setPreferredSize(new Dimension(400, 300)); this.setLayout(new BorderLayout()); scrollpane = new JScrollPane(tables[0]); if(tables.length>1) { // create spinner SpinnerModel model = new SpinnerNumberModel(0, 0, tables.length-1, 1); spinner = new JSpinner(model); JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner); editor.getTextField().setFont(tables[0].indexRenderer.getFont()); spinner.setEditor(editor); spinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { int i = ((Integer) spinner.getValue()).intValue(); scrollpane.setViewportView(tables[i]); } }); Dimension dim = spinner.getMinimumSize(); spinner.setMaximumSize(dim); add(scrollpane, BorderLayout.CENTER); JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.add(new JLabel(" index ")); //$NON-NLS-1$ toolbar.add(spinner); toolbar.add(Box.createHorizontalGlue()); add(toolbar, BorderLayout.NORTH); } else { scrollpane.createHorizontalScrollBar(); add(scrollpane, BorderLayout.CENTER); } this.validate(); // refresh the display }
Example 5
Source File: ArrayInspector.java From osp with GNU General Public License v3.0 | 5 votes |
/** * Creates the GUI. */ protected void createGUI() { setSize(400, 300); setContentPane(new JPanel(new BorderLayout())); scrollpane = new JScrollPane(tables[0]); if(tables.length>1) { // create spinner SpinnerModel model = new SpinnerNumberModel(0, 0, tables.length-1, 1); spinner = new JSpinner(model); JSpinner.NumberEditor editor = new JSpinner.NumberEditor(spinner); editor.getTextField().setFont(tables[0].getFont()); spinner.setEditor(editor); spinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { int i = ((Integer) spinner.getValue()).intValue(); scrollpane.setViewportView(tables[i]); } }); Dimension dim = spinner.getMinimumSize(); spinner.setMaximumSize(dim); getContentPane().add(scrollpane, BorderLayout.CENTER); JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); toolbar.add(new JLabel(" index ")); //$NON-NLS-1$ toolbar.add(spinner); toolbar.add(Box.createHorizontalGlue()); getContentPane().add(toolbar, BorderLayout.NORTH); } else { scrollpane.createHorizontalScrollBar(); getContentPane().add(scrollpane, BorderLayout.CENTER); } }