Java Code Examples for org.jdesktop.swingx.table.TableColumnExt#setWidth()
The following examples show how to use
org.jdesktop.swingx.table.TableColumnExt#setWidth() .
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: DSWorkbenchWatchtowerFrame.java From dsworkbench with Apache License 2.0 | 5 votes |
@Override public void resetView() { KnownVillageManager.getSingleton().addManagerListener(this); MarkerManager.getSingleton().addManagerListener(this); jWatchtowerTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); String[] cols = new String[]{"Stufe", "Farbe"}; for (String col : cols) { TableColumnExt columns = jWatchtowerTable.getColumnExt(col); columns.setPreferredWidth(80); columns.setMaxWidth(80); columns.setWidth(80); } ((WatchtowerTableModel) jWatchtowerTable.getModel()).fireTableDataChanged(); }
Example 2
Source File: DSWorkbenchDistanceFrame.java From dsworkbench with Apache License 2.0 | 5 votes |
public void resetView(boolean pClear) { if (pClear) { DistanceManager.getSingleton().clear(); } jDistanceTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); int w0 = 200; for (int i = 0; i < jDistanceTable.getColumnCount(); i++) { TableColumnExt column = jDistanceTable.getColumnExt(i); if (i == 0) { column.setWidth(w0); column.setPreferredWidth(w0); column.setMaxWidth(w0); column.setMinWidth(w0); column.setResizable(false); } else { String v = (String) column.getHeaderValue(); int w = getGraphics().getFontMetrics().stringWidth(v); column.setWidth(w); column.setPreferredWidth(w); } } jDistanceTable.getTableHeader().setDefaultRenderer(new DefaultTableHeaderRenderer()); if (pClear) { ((DistanceTableModel) jDistanceTable.getModel()).fireTableStructureChanged(); } else { ((DistanceTableModel) jDistanceTable.getModel()).fireTableDataChanged(); } DefaultComboBoxModel model = new DefaultComboBoxModel(); model.addElement(UnknownUnit.getSingleton()); for (UnitHolder unit : DataHolder.getSingleton().getUnits()) { model.addElement(unit); } unitBox.setModel(model); }
Example 3
Source File: UIHelper.java From dsworkbench with Apache License 2.0 | 5 votes |
public static void initTableColums(JXTable table, int width, String... headers) { for (String caption : headers) { TableColumnExt columns = table.getColumnExt(caption); columns.setPreferredWidth(width); columns.setMaxWidth(width); columns.setWidth(width); } }