Java Code Examples for javax.swing.table.TableColumn#setModelIndex()
The following examples show how to use
javax.swing.table.TableColumn#setModelIndex() .
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: SorterTableColumnModel.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void moveColumn(int fromIndex, int toIndex) { TableColumn from = columnList.get(fromIndex); TableColumn to = columnList.get(toIndex); columnList.set(fromIndex, to); to.setModelIndex(fromIndex); columnList.set(toIndex, from); from.setModelIndex(toIndex); orderUpdate(); for (TableColumnModelListener w : new ArrayList<>(watchers)) { w.columnMoved(new TableColumnModelEvent(this, fromIndex, toIndex)); } }
Example 2
Source File: ProductEntryTableModel.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
public ProductEntryTableModel(final ProductEntry[] productList, boolean minimalView) { this.productEntryList = productList; dataProviders.add(new IDProvider()); dataProviders.add(new PropertiesProvider(minimalView)); if (!minimalView) { try { dataProviders.add(new QuicklookProvider()); } catch (Exception e) { e.printStackTrace(); Dialogs.showError(e.getMessage()); } } for (final DataProvider provider : dataProviders) { final TableColumn tableColumn = provider.getTableColumn(); tableColumn.setModelIndex(getColumnCount()); columnList.add(tableColumn); } }
Example 3
Source File: MatrixPropertyTable.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
public void removeColumn(int index) { TableColumn column = getColumnModel().getColumn(index); int modelIndex = column.getModelIndex(); Vector<?> modelData = model.getDataVector(); Vector<?> columnIdentifiers = model.getColumnIdentifiers(); // remove the column from the table removeColumn(column); // remove the column header from the table model columnIdentifiers.removeElementAt(modelIndex); // remove the column data for (Object row : modelData) { ((Vector<?>) row).removeElementAt(modelIndex); } model.setDataVector(modelData, columnIdentifiers); // correct the model indices in the TableColumn objects Enumeration<TableColumn> columns = getColumnModel().getColumns(); while (columns.hasMoreElements()) { TableColumn currentColumn = columns.nextElement(); if (currentColumn.getModelIndex() >= modelIndex) { currentColumn.setModelIndex(currentColumn.getModelIndex() - 1); } } }
Example 4
Source File: AOITableModel.java From snap-desktop with GNU General Public License v3.0 | 5 votes |
public AOITableModel(final AOI[] aoiList) { this.aoiList = aoiList; //dataProviders.add(new IDProvider()); dataProviders.add(new AOIDetailsProvider()); for (final DataProvider provider : dataProviders) { final TableColumn tableColumn = provider.getTableColumn(); tableColumn.setModelIndex(getColumnCount()); columnList.add(tableColumn); } }