List of usage examples for javax.swing.table TableColumn setIdentifier
@BeanProperty(description = "A unique identifier for this column.") public void setIdentifier(Object identifier)
TableColumn
's identifier to anIdentifier
. From source file:DisplayModeModel.java
private void initComponents(Container c) { setContentPane(c);/*from ww w. j a v a 2 s . co m*/ c.setLayout(new BorderLayout()); // Current DM JPanel currentPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); c.add(currentPanel, BorderLayout.NORTH); JLabel current = new JLabel("Current Display Mode : "); currentPanel.add(current); currentPanel.add(currentDM); // Display Modes JPanel modesPanel = new JPanel(new GridLayout(1, 2)); c.add(modesPanel, BorderLayout.CENTER); // List of display modes for (int i = 0; i < COLUMN_WIDTHS.length; i++) { TableColumn col = new TableColumn(i, COLUMN_WIDTHS[i]); col.setIdentifier(COLUMN_NAMES[i]); col.setHeaderValue(COLUMN_NAMES[i]); dmList.addColumn(col); } dmList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); dmList.getSelectionModel().addListSelectionListener(this); modesPanel.add(dmPane); // Controls JPanel controlsPanelA = new JPanel(new BorderLayout()); modesPanel.add(controlsPanelA); JPanel controlsPanelB = new JPanel(new GridLayout(2, 1)); controlsPanelA.add(controlsPanelB, BorderLayout.NORTH); // Exit JPanel exitPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); controlsPanelB.add(exitPanel); exitPanel.add(exit); // Change DM JPanel changeDMPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); controlsPanelB.add(changeDMPanel); changeDMPanel.add(changeDM); controlsPanelA.add(new JPanel(), BorderLayout.CENTER); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopAbstractTable.java
protected void setColumnIdentifiers() { int i = 0;// w w w . j a v a2s . c om for (TableColumn tableColumn : getAllColumns()) { Column column = columnsOrder.get(i++); if (!(tableColumn.getIdentifier() instanceof Column)) { tableColumn.setIdentifier(column); } } }