JScrollPane CompTableScrollpane = new JScrollPane(CompTable, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); JPanel bottomPanel = CreateBottomPanel(); frame = new JFrame("Comp Table Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(CompTableScrollpane, BorderLayout.CENTER); frame.add(bottomPanel, BorderLayout.SOUTH); frame.setPreferredSize(new Dimension(800, 400)); frame.setLocation(150, 150); frame.pack(); frame.setVisible(true); CompModel = new CompTableModel(); CompModel.addRow(); JTable table = new JTable(CompModel); table.setRowHeight(new CompCellPanel().getPreferredSize().height); table.setTableHeader(null); CompCellEditorRenderer compCellEditorRenderer = new CompCellEditorRenderer(); panel.add(addButton); return panel;
private JTable getTable(Object[][] tableData, String[] columnNames, double[] yBounds) { JTable table = new JTable(tableData, columnNames); table.setRowHeight(40); table.setDefaultRenderer(Object.class, new GlyphCellRenderer(yBounds)); return table; }
private void initUI(DeviceNColorant[] colorants) { panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.setPreferredSize(new Dimension(300, 500)); JLabel colorSpaceLabel = new JLabel("DeviceN colorspace"); colorSpaceLabel.setAlignmentX(Component.CENTER_ALIGNMENT); colorSpaceLabel.setFont(new Font(Font.MONOSPACED, Font.BOLD, 30)); DeviceNTableModel tableModel = new DeviceNTableModel(colorants); JTable table = new JTable(tableModel); table.setDefaultRenderer(Color.class, new ColorBarCellRenderer()); table.setRowHeight(60); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(table); panel.add(colorSpaceLabel); panel.add(scrollPane); }
private void init(JLabel label, String[] columns, TableSorter sorter) { tableModel = new PropertiesTableModel(columns); tableModel.addTableModelListener(this); if(sorter == null) { sorter = new TableSorter(tableModel); } this.sorter = sorter; table = new SortedTable(this.sorter); table.getTableHeader().setReorderingAllowed(false); table.setDefaultRenderer(String.class, new PropertiesTableCellRenderer()); //table.setDefaultEditor(CommitOptions.class, new CommitOptionsCellEditor()); table.getTableHeader().setReorderingAllowed(true); table.setRowHeight(table.getRowHeight()); table.addAncestorListener(this); component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); component.setPreferredSize(new Dimension(340, 150)); table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(PropertiesTable.class, "ACSD_PropertiesTable")); // NOI18N label.setLabelFor(table); setColumns(columns); }
}; mainTable = new JTable(data, columnNames); mainTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); mainTable.setPreferredScrollableViewportSize(new Dimension(500, 70)); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); maxHeight = Math.max(heightPreferable, maxHeight); jTable.setRowHeight(row, maxHeight);
public static void main(String[] args) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(new Dimension(500,500)); table.setRowHeight(50); JScrollPane scp = new JScrollPane(table); frame.add(scp);
table.setRowHeight( 32 ); showFrame( table ); f.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); f.add( new JScrollPane( table ) ); f.pack(); f.setVisible( true ); boolean isSelected, boolean hasFocus, int row, int column) { this.add( new JTextField( value.toString() ) ); this.add( new JButton("+")); this.add( new JButton("-")); return this;
JTable table = new JTable(tableModel); table.setDefaultRenderer(Color.class, new ColorBarCellRenderer()); table.setRowHeight(40); table.getColumnModel().getColumn(0).setMinWidth(30); table.getColumnModel().getColumn(0).setMaxWidth(50); table.getColumnModel().getColumn(1).setMaxWidth(100); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(table); scrollPane.setAlignmentX(Component.LEFT_ALIGNMENT);
JTable t = new JTable(5, 5); t.setRowHeight(2, 30);
private void init(JLabel label, String[] columns, TableSorter sorter) { tableModel = new CommitTableModel(columns); tableModel.addTableModelListener(this); if(sorter == null) { sorter = new TableSorter(tableModel); } this.sorter = sorter; table = new SortedTable(this.sorter); table.getTableHeader().setReorderingAllowed(false); table.setDefaultRenderer(String.class, new CommitStringsCellRenderer()); table.setDefaultRenderer(Boolean.class, new CheckboxCellRenderer()); table.setDefaultEditor(Boolean.class, new CheckboxCellEditor()); table.getTableHeader().setReorderingAllowed(true); table.setRowHeight(table.getRowHeight() * 6 / 5); table.addAncestorListener(this); component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); label.setLabelFor(table); table.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CommitTable.class, "ACSD_CommitTable")); // NOI18N table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction"); // NOI18N table.getActionMap().put("org.openide.actions.PopupAction", new AbstractAction() { // NOI18N @Override public void actionPerformed(ActionEvent e) { showPopup(org.netbeans.modules.versioning.util.Utils.getPositionForPopup(table)); } }); table.addMouseListener(this); setColumns(columns); }
final JTable jTable1 = new JTable(model1); jTable1.setBackground(Color.orange); jTable1.setForeground(Color.blue); jTable1.setRowHeight(24); jTable1.setFont(new Font("Arial", Font.BOLD, 12)); jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); final JScrollPane sp1 = new JScrollPane(); sp1.setPreferredSize(new Dimension(600, 200)); sp1.setViewportView(jTable1); final JTable jTable2 = new JTable(model1); jTable2.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); final JScrollPane sp2 = new JScrollPane(); sp2.setPreferredSize(new Dimension(600, 200)); sp2.setViewportView(jTable2);
protected JPanel createEditorPanel() { table = new JTable(); table.setRowHeight(25); table.setRowMargin(3); table.setPreferredScrollableViewportSize(TABLE_DIM); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JPanel panel = new JPanel(new BorderLayout()); panel.add(new JScrollPane(table), BorderLayout.CENTER); return panel; }
JTable table = new JTable(...); table.setRowHeight( 25 );
private void init(VCSCommitTableModel<F> tableModel) { this.tableModel = tableModel; tableModel.addTableModelListener(this); sorter = new TableSorter(tableModel); table = new SortedTable(this.sorter); table.getTableHeader().setReorderingAllowed(false); table.setDefaultRenderer(String.class, new CommitStringsCellRenderer()); table.setDefaultRenderer(Boolean.class, new CheckboxCellRenderer()); table.setDefaultEditor(Boolean.class, new CheckboxCellEditor()); table.getTableHeader().setReorderingAllowed(true); table.setRowHeight(table.getRowHeight() * 6 / 5); table.addAncestorListener(this); component = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); table.getAccessibleContext().setAccessibleName(modifier.getMessage(VCSCommitPanelModifier.BundleMessage.FILE_TABLE_ACCESSIBLE_NAME)); table.getAccessibleContext().setAccessibleDescription(modifier.getMessage(VCSCommitPanelModifier.BundleMessage.FILE_TABLE_ACCESSIBLE_DESCRIPTION)); table.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put( KeyStroke.getKeyStroke(KeyEvent.VK_F10, KeyEvent.SHIFT_DOWN_MASK ), "org.openide.actions.PopupAction"); // NOI18N table.getActionMap().put("org.openide.actions.PopupAction", new AbstractAction() { // NOI18N @Override public void actionPerformed(ActionEvent e) { showPopup(org.netbeans.modules.versioning.util.Utils.getPositionForPopup(table)); } }); table.addMouseListener(this); setColumns(VCSCommitTableModel.COMMIT_COLUMNS); }
{"dddddd", "eeeeeee", "aaaaaa", "bbbbbb", "cccccc",}, {"eeeeeee", "aaaaaa", "bbbbbb", "cccccc", "dddddd",}}; private JTable table = new JTable(new DefaultTableModel(data, columnNames)); private TableColumnModel tcm = table.getColumnModel(); private Stack<TableColumn> colDeleted = new Stack<TableColumn>(); table.setRowHeight(30); table.setFont(new Font("SansSerif", Font.BOLD + Font.PLAIN, 20)); JScrollPane scrollPane = new JScrollPane(table); for (int i = 0; i < (tcm.getColumnCount()); i++) { tcm.getColumn(i).setPreferredWidth(100); btnPanel.add(hideButton); btnPanel.add(restoreButton); btnPanel.add(deleteButton); btnPanel.add(addButton); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(scrollPane, BorderLayout.CENTER); frame.add(btnPanel, BorderLayout.SOUTH); frame.pack(); frame.setLocation(150, 150); frame.setVisible(true);
private void init() { // Table tableBody = new JTable(); tableBody.setName(""); tableBody.setModel(httpPanelTabularModel); tableBody.setGridColor(java.awt.Color.gray); tableBody.setIntercellSpacing(new java.awt.Dimension(1, 1)); tableBody.setRowHeight(DisplayUtils.getScaledSize(18)); // Issue 954: Force the JTable cell to auto-save when the focus changes. // Example, edit cell, click OK for a panel dialog box, the data will get saved. tableBody.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); // Main panel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(new JScrollPane(tableBody), BorderLayout.CENTER); }
JFrame f = new JFrame("Test"); JTable t = new JTable(); ((DefaultTableModel)t.getModel()).setDataVector(new Object[][]{ {"<html>Next word is <font color=\"red\">RED</font>.</html>", "50px"}, {"<html>Following is <font color=\"blue\">BLUE</font>.<br><br>" + "Long lines are automatically wrapped" + " as this long line demonstrates it.</html>", "150px"}, }, new Object[]{"Formatted text","Height"}); t.setRowHeight(0, 50); t.setRowHeight(1, 150); f.add(new JScrollPane(t)); f.pack(); f.setVisible(true);
{"dddddd", "eeeeeee", "aaaaaa", "bbbbbb", "cccccc",}, {"eeeeeee", "aaaaaa", "bbbbbb", "cccccc", "dddddd",}}; private JTable table = new JTable(new DefaultTableModel(data, columnNames)); private TableColumnModel tcm = table.getColumnModel(); private Stack<TableColumn> colDeleted = new Stack<TableColumn>(); table.setRowHeight(30); table.setFont(new Font("SansSerif", Font.BOLD + Font.PLAIN, 20)); JScrollPane scrollPane = new JScrollPane(table); for (int i = 0; i < (tcm.getColumnCount()); i++) { tcm.getColumn(i).setPreferredWidth(150); btnPanel.add(hideButton); btnPanel.add(restoreButton); btnPanel.add(deleteButton); btnPanel.add(addButton); frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); frame.add(scrollPane, BorderLayout.CENTER); frame.add(btnPanel, BorderLayout.SOUTH); frame.pack(); frame.setLocation(150, 150); frame.setVisible(true);
private MainPanel() { super(new BorderLayout()); JTable table = new JTable(); URL url = getClass().getResource("restore_to_background_color.gif"); Object[][] data = { {"Default ImageIcon", new ImageIcon(url)}, {"ImageIcon#setImageObserver", makeImageIcon(url, table, 1, 1)} }; String[] columnNames = {"String", "ImageIcon"}; table.setModel(new DefaultTableModel(data, columnNames) { @Override public Class<?> getColumnClass(int column) { return getValueAt(0, column).getClass(); } @Override public boolean isCellEditable(int row, int column) { return column == 0; } }); table.setAutoCreateRowSorter(true); table.setRowHeight(20); add(new JScrollPane(table)); setPreferredSize(new Dimension(320, 240)); }
protected void createScriptParameterTable() { $objectMap.put("scriptParameterTable", scriptParameterTable = new JTable()); scriptParameterTable.setName("scriptParameterTable"); scriptParameterTable.setRowHeight(24); }