private void configureTableAppearance() { tableDevices.setOpaque(false); ((DefaultTableCellRenderer) tableDevices.getDefaultRenderer(Object.class)).setOpaque(false); tableDevices.setAutoResizeMode(JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS); tableDevices.getColumnModel().getColumn(0).setPreferredWidth(100); tableDevices.getColumnModel().getColumn(1).setMinWidth(85); tableDevices.getColumnModel().getColumn(1).setMaxWidth(85); tableDevices.getColumnModel().getColumn(2).setMinWidth(215); tableDevices.getColumnModel().getColumn(2).setMaxWidth(215); tableDevices.getColumnModel().getColumn(2).setCellRenderer(new ConnectDisconnectRenderer()); tableDevices.getColumnModel() .getColumn(2) .setCellEditor(new ConnectDisconnectEditor(new JCheckBox(), this)); }
protected void adjustTableUI() { logTable.setFocusable(false); logTable.setRowHeight(18); logTable.getTableHeader().setReorderingAllowed(false); logTable.setBorder(BorderFactory.createEmptyBorder()); logTable.getColumnModel().getColumn(0).setMinWidth(30); logTable.getColumnModel().getColumn(0).setMaxWidth(30); logTable.getColumnModel().getColumn(0).setResizable(false); logTable.getColumnModel().getColumn(1).setMinWidth(90); logTable.getColumnModel().getColumn(1).setMaxWidth(90); logTable.getColumnModel().getColumn(1).setResizable(false); logTable.getColumnModel().getColumn(2).setMinWidth(110); logTable.getColumnModel().getColumn(2).setMaxWidth(250); logTable.getColumnModel().getColumn(3).setPreferredWidth(150); logTable.getColumnModel().getColumn(3).setMaxWidth(400); logTable.getColumnModel().getColumn(4).setPreferredWidth(600); }
private void setListDataFrom(List<Match> matches) { resultsTable.setModel(tableModelFrom(matches)); TableColumnModel colModel = resultsTable.getColumnModel(); TableColumn column; int width; for (int i = 0; i < matchColumns.length; i++) { if (matchColumns[i].width() > 0) { column = colModel.getColumn(i); width = matchColumns[i].width(); column.setPreferredWidth(width); column.setMinWidth(width); column.setMaxWidth(width); } } }
/** * Set initial value of width for columns in table. */ private void setColumnsInitialWidth() { final FontMetrics fontMetrics = getFontMetrics(getFont()); // Six character string to contain "Column" column. final int widthOfSixCharacterString = fontMetrics.stringWidth("XXXXXX"); // Padding must be added to width for columns to make them fully // visible in table header. final int padding = 10; final int widthOfColumnContainingSixCharacterString = widthOfSixCharacterString + padding; getColumn("Line").setMaxWidth(widthOfColumnContainingSixCharacterString); getColumn("Column").setMaxWidth(widthOfColumnContainingSixCharacterString); final int preferredTreeColumnWidth = Math.toIntExact(Math.round(getPreferredSize().getWidth() * 0.6)); getColumn("Tree").setPreferredWidth(preferredTreeColumnWidth); // Twenty eight character string to contain "Type" column final int widthOfTwentyEightCharacterString = fontMetrics.stringWidth("XXXXXXXXXXXXXXXXXXXXXXXXXXXX"); final int preferredTypeColumnWidth = widthOfTwentyEightCharacterString + padding; getColumn("Type").setPreferredWidth(preferredTypeColumnWidth); }
table.getColumnModel().getColumn(0).setMaxWidth(0); table.getColumnModel().getColumn(0).setMinWidth(0); table.getTableHeader().getColumnModel().getColumn(0).setMaxWidth(0); table.getTableHeader().getColumnModel().getColumn(0).setMinWidth(0); table.getColumnModel().getColumn(1).setMaxWidth(300); table.getColumnModel().getColumn(1).setPreferredWidth(90); table.getColumnModel().getColumn(2).setMaxWidth(50); table.getColumnModel().getColumn(2).setPreferredWidth(30); table.getColumnModel().getColumn(3).setMaxWidth(50); table.getColumnModel().getColumn(3).setPreferredWidth(30); table.getColumnModel().getColumn(5).setMaxWidth(100); table.getColumnModel().getColumn(5).setPreferredWidth(55); table.getColumnModel().getColumn(6).setMaxWidth(200); table.getColumnModel().getColumn(6).setPreferredWidth(50); table.getColumnModel().getColumn(7).setMaxWidth(300); table.getColumnModel().getColumn(7).setPreferredWidth(90); table.getColumnModel().getColumn(8).setMaxWidth(300); table.getColumnModel().getColumn(8).setPreferredWidth(90);
getColumnModel().getColumn(0).setMaxWidth(50); getColumnModel().getColumn(0).setPreferredWidth(50); getColumnModel().getColumn(1).setMaxWidth(50); getColumnModel().getColumn(1).setPreferredWidth(50); getColumnModel().getColumn(2).setMaxWidth(150); getColumnModel().getColumn(2).setPreferredWidth(60); getColumnModel().getColumn(3).setMaxWidth(60); getColumnModel().getColumn(3).setPreferredWidth(60); getColumnModel().getColumn(4).setMaxWidth(60); getColumnModel().getColumn(4).setPreferredWidth(60); getColumnModel().getColumn(5).setMaxWidth(150); getColumnModel().getColumn(5).setPreferredWidth(80); getColumnModel().getColumn(6).setMaxWidth(60); getColumnModel().getColumn(6).setPreferredWidth(60);
public StateVariableTable(List<StateVariableValue> values) { this.valuesModel = new StateVariableValuesTableModel(values); setRowHeight(25); setRowSelectionAllowed(true); setColumnSelectionAllowed(false); setCellSelectionEnabled(true); setModel(valuesModel); getColumnModel().getColumn(0).setHeaderValue("State Variable"); getColumnModel().getColumn(0).setMinWidth(100); getColumnModel().getColumn(0).setMaxWidth(250); getColumnModel().getColumn(0).setPreferredWidth(200); getColumnModel().getColumn(1).setHeaderValue("Value"); setDefaultRenderer(StateVariableValue.class, new StateVariableValueCellRenderer()); }
public ActionArgumentTable(Action action, boolean isInput) { ActionArgumentValue[] argumentValues = isInput ? createDefaultValuesInput(action) : createDefaultValuesOutput(action); this.argumentValuesModel = new ActionArgumentValuesTableModel(argumentValues); setRowHeight(25); setRowSelectionAllowed(false); setColumnSelectionAllowed(false); setCellSelectionEnabled(false); setFocusable(false); registerKeyboardAction( new CellEditorNavigationAction(true), KeyStroke.getKeyStroke(KeyEvent.VK_TAB, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); registerKeyboardAction( new CellEditorNavigationAction(false), KeyStroke.getKeyStroke(KeyEvent.VK_TAB, KeyEvent.SHIFT_MASK, false), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); setModel(argumentValuesModel); getColumnModel().getColumn(0).setHeaderValue((isInput ? "IN" : "OUT") + " Argument"); getColumnModel().getColumn(0).setMinWidth(100); getColumnModel().getColumn(0).setMaxWidth(250); getColumnModel().getColumn(0).setPreferredWidth(200); getColumnModel().getColumn(1).setHeaderValue("Value"); setDefaultRenderer( ActionArgumentValue.class, new ArgumentValueCellRenderer(isInput) ); }
private void setColumnWith(final JTable table, final int columnIndex, final int minSize, final int preferredSize, final Integer maxSize) { final TableColumn column = table.getColumnModel().getColumn(columnIndex); column.setMinWidth(minSize); column.setWidth(preferredSize); column.setPreferredWidth(preferredSize); if (maxSize != null) { column.setMaxWidth(maxSize); } }
public void setDeckEditorMode(DeckEditorMode mode) { if (mode == DeckEditorMode.FREE_BUILDING) { // activate spinner for card number change mainModel.setNumberEditable(true); TableColumnModel tcm = mainTable.getColumnModel(); TableColumn tc = tcm.getColumn(0); tc.setMaxWidth(55); tc.setMinWidth(55); tc.setPreferredWidth(55); tc.setCellEditor(new TableSpinnerEditor(this)); } }
@Override public void setBounds(int x, int y, int width, int height) { super.setBounds(x, y, width, height); // This is totally bogus, but they look alright when I throw in a max // width for the boolean columns. setPreferredColumnWidths(new double[] {0.25, 0.3, 0.2, 0.2, 0.2} ); getColumnModel().getColumn(COL_INDEX_SENT).setResizable(false); getColumnModel().getColumn(COL_INDEX_SENT).setMaxWidth(50); getColumnModel().getColumn(COL_INDEX_DONE).setResizable(false); getColumnModel().getColumn(COL_INDEX_DONE).setMaxWidth(50); }
table.setRowHeight(40); table.getColumnModel().getColumn(0).setMinWidth(30); table.getColumnModel().getColumn(0).setMaxWidth(50); table.getColumnModel().getColumn(1).setMinWidth(100); table.getColumnModel().getColumn(1).setMaxWidth(100);
DefaultTableCellRenderer myRenderer = (DefaultTableCellRenderer) mainTable.getDefaultRenderer(String.class); myRenderer.setBackground(new Color(0, 0, 0, 100)); mainTable.getColumnModel().getColumn(0).setMaxWidth(0); mainTable.getColumnModel().getColumn(0).setPreferredWidth(10); mainTable.getColumnModel().getColumn(1).setPreferredWidth(110);
DefaultTableCellRenderer myRenderer = (DefaultTableCellRenderer) mainTable.getDefaultRenderer(String.class); myRenderer.setBackground(new Color(0, 0, 0, 100)); mainTable.getColumnModel().getColumn(0).setMaxWidth(25); mainTable.getColumnModel().getColumn(0).setPreferredWidth(25); mainTable.getColumnModel().getColumn(1).setPreferredWidth(110);
settingsTable.getTableHeader().setReorderingAllowed(false); settingsTable.getColumnModel().getColumn(0).setMinWidth(60); settingsTable.getColumnModel().getColumn(0).setMaxWidth(80); settingsTable.getColumnModel().getColumn(2).setPreferredWidth(85);
SchemaExplorer.DEF_SQL); tableRenderer.setModel(ptm); tableRenderer.getColumnModel().getColumn(0).setMaxWidth(100); tableRenderer.getColumnModel().getColumn(0).setMinWidth(100); return tableRenderer; SchemaExplorer.DEF_SQL); tableRenderer.setModel(ptm); tableRenderer.getColumnModel().getColumn(0).setMaxWidth(100); tableRenderer.getColumnModel().getColumn(0).setMinWidth(100); return tableRenderer; workbench, value, SchemaExplorer.DEF_FORMULA); tableRenderer.setModel(ptm); tableRenderer.getColumnModel().getColumn(0).setMaxWidth(100); tableRenderer.getColumnModel().getColumn(0).setMinWidth(100); return tableRenderer; SchemaExplorer.DEF_CALCULATED_MEMBER_PROPERTY); tableRenderer.setModel(ptm); tableRenderer.getColumnModel().getColumn(0).setMaxWidth(100); tableRenderer.getColumnModel().getColumn(0).setMinWidth(100); return tableRenderer; workbench, value, SchemaExplorer.DEF_TABLE); tableRenderer.setModel(ptm); tableRenderer.getColumnModel().getColumn(0).setMaxWidth(100); tableRenderer.getColumnModel().getColumn(0).setMinWidth(100); return tableRenderer;
TableColumn column = columnModel.getColumn(i); column.setMinWidth(0); column.setMaxWidth(0); this.fixedTable.getColumnModel().addColumn(new TableColumn(i));
workbench, value, SchemaExplorer.DEF_FORMULA); tableEditor.setModel(ptm); tableEditor.getColumnModel().getColumn(0).setMaxWidth(100); tableEditor.getColumnModel().getColumn(0).setMinWidth(100); activeEditor = tableEditor; SchemaExplorer.DEF_CALCULATED_MEMBER_PROPERTY); tableEditor.setModel(ptm); tableEditor.getColumnModel().getColumn(0).setMaxWidth(100); tableEditor.getColumnModel().getColumn(0).setMinWidth(100); activeEditor = tableEditor; tableEditor.getColumnModel().getColumn(0).setMaxWidth(100); tableEditor.getColumnModel().getColumn(0).setMinWidth(100); activeEditor = tableEditor; ptm.setFactTable(selectedFactTable); tableEditor.setModel(ptm); tableEditor.getColumnModel().getColumn(0).setMaxWidth(100); tableEditor.getColumnModel().getColumn(0).setMinWidth(100); activeEditor = tableEditor; tableEditor.getColumnModel().getColumn(0).setMaxWidth(100); tableEditor.getColumnModel().getColumn(0).setMinWidth(100); spcr.setTableRendererHeight(tableEditor, null);
propertyTable.getColumnModel().getColumn(0).setMaxWidth(150); propertyTable.getColumnModel().getColumn(0).setMinWidth(150);
private void setColumnsToIconSize(JTable keyStoreTable, int... columnNumbers) { for (int i : columnNumbers) { TableColumn typeCol = keyStoreTable.getColumnModel().getColumn(i); typeCol.setResizable(false); typeCol.setMinWidth(ICON_SIZE); typeCol.setMaxWidth(ICON_SIZE); typeCol.setPreferredWidth(ICON_SIZE); } }