@Override public void add(Component comp, Object constraints) { if (constraints == searchConstraints) { searchPanel = comp; constraints = null; } super.add(comp, constraints); }
@Override public void add(Component comp, Object constraints) { if (constraints == searchConstraints) { searchPanel = comp; constraints = null; } super.add(comp, constraints); }
// Problem #1... JScrollPane pane = new JScrollPane(); pane.add(buttonPanel); //... // Problem #2... panel.add(pane); frame.add(panel);
JScrollPane scrollPane = new JScrollPane(); scrollPane.add( panel );
JScrollPane jps = new JScrollPane(); jps.add(table);
JScrollPane scrollPane = new JScrollPane(); scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.add(cSoftware); panel.add(scrollPane); //add buttons etc
JScrollPane s = new JScrollPane(); JPanel p = new JPanel(); s.add(p);
JLabel[] pics = // Put pictures into labels JPanel panel = new JPanel(); panel.setLayoutManager(/* FlowLayout if the pics are the same size; GridLayout otherwise? */); for (JLabel pic : pics) { panel.add(pic); } JScrollPane scroll = new JScrollPane(); scroll.add(panel); // Disable the vertical scrollbar scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
JScrollPane scrollPane = new JScrollPane(); JTextArea textArea = new JTextArea(); scrollPane.add(textArea); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
public class test { private static JFrame frame = new JFrame(); private static JTabbedPane pane0 = new JTabbedPane(); private static JScrollPane pane1 = new JScrollPane(); private static JPanel pane2 = new JPanel(); //add the rest of your JPanels here public static void main(String[] args) { frame.setSize(400,400); //add all the other attributes here frame.add(pane0); pane0.add(pane1); pane1.add(pane2); //go ahead and add the rest of your panels here frame.pack();//resizes the frame so that its subcomponents fit well inside. } }//this last bracket is for the class itself. Sorry i couldn't tab everything the right //way.
tabbedPane = new JTabbedPane(JTabbedPane.TOP); tabbedPane.setBounds(446, 50, 397, 490); tabbedPane.setBorder(new SoftBevelBorder(BevelBorder.LOWERED, null, null, null, null)); tabbedPane.setFont(new Font("Carlito", Font.PLAIN, 13)); tabbedPane.setBackground(Color.WHITE); frame.getContentPane().add(tabbedPane); // JFrame tableMainTest = new JTable(); tableMainTest.setName("tableMainTest"); tableMainTest.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableMainTest.setFont(new Font("Carlito", Font.PLAIN, 13)); tableMainTest.setFocusable(false); tableMainTest.setModel(tableModel); tableMainTest.setPreferredScrollableViewportSize(tableMainTest.getPreferredSize()); tableMainTest.changeSelection(0, 0, false, false); tableMainTest.setAutoCreateRowSorter(true); JScrollPane scrollMain = new JScrollPane(tableMainTest); scrollMain.add(tableMainTest.getTableHeader()); scrollMain.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER ); scrollMain.setBounds(446, 50, 397, 490); tabbedPane.addTab(descrTableMain, scrollMain);
public void addData(Vector data) { int actDatum = 0; String rows[][] = new String[data.size()][columns]; Iterator it = data.iterator(); while (it.hasNext()) { String[] o = (String[]) it.next(); int l = o.length; for (int i = 0; i < l; i++) { rows[actDatum][i] = o[i]; } actDatum += 1; } DefaultTableModel model = new DefaultTableModel(rows, this.header); tableSorter = new TableSorter(model); commonTable = new JTable(tableSorter); tableSorter.setTableHeader(commonTable.getTableHeader()); commonTable.getColumnModel().getColumn(0).setWidth(this.columnWidth); jScrollPane.add(commonTable, null); }
public void cmdToBar(JScrollPane scrollPane, JInternalFrame cmdFrame) { desktop.remove(cmdFrame); cmdFrame.dispose(); scrollPane.getViewport().setMaximumSize(new Dimension(frame.getSize().width, 35)); scrollPane.getViewport().setPreferredSize(new Dimension(frame.getSize().width, 35)); frame.add(scrollPane, BorderLayout.PAGE_END); desktop.updateUI(); }
JTree tree; JScrollPane scrollPane; DefaultMutableTreeNode root = new DefaultMutableTreeNode("RootNode"); public Tree() { setVisible(true); setSize(100, 300); createChildNodes(root); tree = new JTree(root); tree.setVisible(true); tree.setSize(100, 300); scrollPane = new JScrollPane(tree); scrollPane.add(tree); scrollPane.setVisible(true); scrollPane.setSize(100, 300); scrollPane.setViewportView(this); scrollPane.setBackground(Color.red); }
protected void updateColumnHeader(PropertyChangeEvent e) { JViewport newColHead = (JViewport)(e.getNewValue()); if (newColHead != null) { JViewport viewport = scrollpane.getViewport(); Point p = newColHead.getViewPosition(); if (viewport == null) { p.x = 0; } else { if (scrollpane.getComponentOrientation().isLeftToRight()) { p.x = viewport.getViewPosition().x; } else { p.x = Math.max(0, viewport.getViewPosition().x); } } newColHead.setViewPosition(p); scrollpane.add(newColHead, COLUMN_HEADER); } }
private void initTree() { JTree tree = new JTree(getRootNode()); tree.setCellRenderer(new CheckBoxTreeRenderer()); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.putClientProperty("JTree.lineStyle", "Angled"); //NOI18N NodeSelectionListener listener = new NodeSelectionListener(tree); tree.addMouseListener(listener); tree.addKeyListener(listener); tree.expandRow(0); tree.setShowsRootHandles(true); tree.setSelectionRow(0); initTree(tree); scrollPane.add(tree); scrollPane.setViewportView(tree); }
public void deleteSelected() { String[] delItem; Vector v = this.getTableData(); int rowCount = commonTable.getSelectedRowCount(); int[] selectedRows = commonTable.getSelectedRows(); int columnCount = commonTable.getColumnCount(); for (int i = 0; i < rowCount; i++) { delItem = new String[columnCount]; for (int j = 0; j < columnCount; j++) { delItem[j] = new String(); delItem[j] = (String) commonTable .getValueAt(selectedRows[i], j); } if (v.contains(delItem)) { v.remove(delItem); } } this.addData(v); jScrollPane.add(commonTable, null); jScrollPane.setVisible(true); jScrollPane.repaint(); }
public ClassHierarchyPanel(boolean isView) { initComponents(); if (!isView) { toolBar.remove(0); toolBar.remove(0); subtypeButton.setFocusable(true); supertypeButton.setFocusable(true); } setName(NbBundle.getMessage(getClass(), "CTL_ClassHierarchyTopComponent")); // NOI18N setToolTipText(NbBundle.getMessage(getClass(), "HINT_ClassHierarchyTopComponent")); // NOI18N tree = new JTree(); treeModel = new DefaultTreeModel(new DefaultMutableTreeNode()); tree.setModel(treeModel); tree.setToggleClickCount(0); tree.setCellRenderer(new TreeRenderer()); tree.putClientProperty("JTree.lineStyle", "Angled"); //NOI18N tree.expandRow(0); tree.setShowsRootHandles(true); tree.setSelectionRow(0); tree.setRootVisible(false); hierarchyPane.add(tree); hierarchyPane.setViewportView(tree); tree.addMouseListener(mouseListener); }
labels.configureToolBarButton(pButton, "view.toggleGrid.placard"); placardPanel.add(pButton, BorderLayout.EAST); scrollPane.add(placardPanel, JScrollPane.LOWER_LEFT_CORNER);
labels.configureToolBarButton(pButton, "view.toggleGrid.placard"); placardPanel.add(pButton, BorderLayout.EAST); scrollPane.add(placardPanel, JScrollPane.LOWER_LEFT_CORNER);