Java Code Examples for javax.swing.event.TableColumnModelEvent#getToIndex()
The following examples show how to use
javax.swing.event.TableColumnModelEvent#getToIndex() .
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: TableColumnManager.java From mars-sim with GNU General Public License v3.0 | 6 votes |
public void columnMoved(TableColumnModelEvent e) { if (e.getFromIndex() == e.getToIndex()) return; // A table column has been moved one position to the left or right // in the view of the table so we need to update the manager to // track the new location int index = e.getToIndex(); TableColumn column = tcm.getColumn( index ); allColumns.remove( column ); if (index == 0) { allColumns.add(0, column); } else { index--; TableColumn visibleColumn = tcm.getColumn( index ); int insertionColumn = allColumns.indexOf( visibleColumn ); allColumns.add(insertionColumn + 1, column); } }
Example 2
Source File: PlacemarkManagerTopComponent.java From snap-desktop with GNU General Public License v3.0 | 6 votes |
@Override public void columnAdded(TableColumnModelEvent e) { int minWidth; final int index = e.getToIndex(); switch (index) { case 0: case 1: minWidth = 60; break; default: minWidth = 80; } TableColumnModel columnModel = (TableColumnModel) e.getSource(); columnModel.getColumn(index).setPreferredWidth(minWidth); columnModel.getColumn(index).setCellRenderer(new RightAlignmentTableCellRenderer()); }
Example 3
Source File: IssueTable.java From netbeans with Apache License 2.0 | 5 votes |
@Override public void columnMoved(TableColumnModelEvent e) { int from = e.getFromIndex(); int to = e.getToIndex(); if(from == to) { return; } table.getTableHeader().getColumnModel().getColumn(from).setModelIndex(from); table.getTableHeader().getColumnModel().getColumn(to).setModelIndex(to); tableModel.moveColumn(from, to); }
Example 4
Source File: BugTreeModel.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void columnMoved(final TableColumnModelEvent evt) { if (evt.getFromIndex() == evt.getToIndex()) { return; } sortOrderChanged = true; // rebuild(); }
Example 5
Source File: JAutoColumnTable.java From jeveassets with GNU General Public License v2.0 | 5 votes |
@Override public void columnMoved(final TableColumnModelEvent e) { if (e.getFromIndex() != e.getToIndex()) { if (!columnMoved) { from = e.getFromIndex(); } to = e.getToIndex(); columnMoved = true; } }
Example 6
Source File: JDynamicTable.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void availableColumnAdded(TableColumnModelEvent event) { int index = event.getToIndex(); TableColumn column = dynamicColumnModel.getAvailableColumns().get(index); menu.getItems().add(index, createMenuItem(column)); cornerButton.setVisible(true); }
Example 7
Source File: JDynamicTable.java From pcgen with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void availableColumnAdded(TableColumnModelEvent event) { int index = event.getToIndex(); TableColumn column = dynamicColumnModel.getAvailableColumns().get(index); menu.getItems().add(index, createMenuItem(column)); cornerButton.setVisible(true); }