本文整理汇总了Java中javax.swing.event.TableColumnModelEvent.getToIndex方法的典型用法代码示例。如果您正苦于以下问题:Java TableColumnModelEvent.getToIndex方法的具体用法?Java TableColumnModelEvent.getToIndex怎么用?Java TableColumnModelEvent.getToIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.event.TableColumnModelEvent
的用法示例。
在下文中一共展示了TableColumnModelEvent.getToIndex方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
public void columnMoved(TableColumnModelEvent event)
{
if(isEmpty() || getEventSource() != null) {
return;
}
setEventSource(event.getSource());
int columnIndex = event.getFromIndex();
int newIndex = event.getToIndex();
Collection<TableColumnModel> models = values();
for (TableColumnModel model : models) {
if(model == getEventSource())
continue;
model.moveColumn(columnIndex, newIndex);
}
if(columnIndex != newIndex) {
TableColumnSynchronizer column = columns.get(columnIndex);
columns.remove(columnIndex);
columns.add(newIndex, column);
}
setEventSource(null);
}
示例2: columnAdded
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@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());
}
示例3: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@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);
}
示例4: columnAdded
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@Override
public void columnAdded(TableColumnModelEvent e) {
TableColumnModel sourceModel = (TableColumnModel) e.getSource();
for (int i = e.getFromIndex(); i < e.getToIndex(); i++) {
TableColumn sourceColumn = sourceModel.getColumn(i);
handleColumnAdded(sourceColumn);
}
}
示例5: columnRemoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@Override
public void columnRemoved(TableColumnModelEvent e) {
TableColumnModel sourceModel = (TableColumnModel) e.getSource();
for (int i = e.getFromIndex(); i < e.getToIndex(); i++) {
TableColumn sourceColumn = sourceModel.getColumn(i);
handleColumnRemoved(sourceColumn);
}
}
示例6: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@Override
public void columnMoved(TableColumnModelEvent e)
{
final int indexFrom = e.getFromIndex();
final int indexTo = e.getToIndex();
saveColumnMoved(indexFrom, indexTo);
}
示例7: columnAdded
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@Override
public void columnAdded(TableColumnModelEvent e) {
super.columnAdded(e);
int index = e.getToIndex();
int width;
switch (index) {
case AtomFilterChainTableModel.INDEX_COLUMN :
width = 50;
break;
case AtomFilterChainTableModel.BLOCKING_COLUMN :
width = 40;
break;
case AtomFilterChainTableModel.ENABLED_COLUMN :
width = 40;
break;
case AtomFilterChainTableModel.NAME_COLUMN :
case AtomFilterChainTableModel.TYPE_COLUMN :
default :
width = 200;
break;
}
getColumnModel().getColumn(index).setPreferredWidth(width);
}
示例8: columnAdded
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
/**
* Does the same as {@link JTable#columnAdded(TableColumnModelEvent)} and
* sets the preferred width of the cell to {@link
* MontageFilterEnableTable#COLUMN_SIZE}.
*/
@Override
public void columnAdded(TableColumnModelEvent e) {
super.columnAdded(e);
int index = e.getToIndex();
getColumnModel().getColumn(index).setPreferredWidth(COLUMN_SIZE);
}
示例9: columnAdded
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
/**
* Does the same as {@link JTable#columnAdded(TableColumnModelEvent)} and
* sets the preferred width of the cell to {@link #CELL_SIZE}.
*/
@Override
public void columnAdded(TableColumnModelEvent e) {
super.columnAdded(e);
int index = e.getToIndex();
getColumnModel().getColumn(index).setPreferredWidth(CELL_SIZE);
}
示例10: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@Override
public void columnMoved(final TableColumnModelEvent e) {
if (e.getFromIndex() != e.getToIndex()) {
columnMoveOccured = true;
}
}
示例11: columnAdded
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@Override
public void columnAdded(TableColumnModelEvent e) {
super.columnAdded(e);
int index = e.getToIndex();
getColumnModel().getColumn(index).setPreferredWidth(CELL_SIZE);
}
示例12: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
public void columnMoved(final TableColumnModelEvent evt) {
if (evt.getFromIndex() == evt.getToIndex())
return;
sortOrderChanged = true;
// rebuild();
}
示例13: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
public void columnMoved(TableColumnModelEvent tcme){
int original_index, new_index;
original_index = tcme.getFromIndex();
new_index = tcme.getToIndex();
if(original_index == new_index){
// user is just dragging around without reordering
// leave quickly
return;
}
// since columns have been moved, set flag that files need to be written
need_to_write = true;
need_to_sync = true;
boolean in_range = bjt.getColumnCount() > original_index && bjt.getColumnCount() > new_index;
if(tcme.getSource() == tjt.getColumnModel() && in_range){
// can update columns on lower table and lds2
// commented lines out, since currently lds objects are being synced in the
// syncTables() method when the mouse is release,
// and just the GUI can be done now
//MatchingTableModel mtm_top = (MatchingTableModel)tjt.getModel();
//MatchingTableModel mtm_bottom = (MatchingTableModel)bjt.getModel();
//TableColumn tc_bottom = bjt.getColumnModel().getColumn(original_index);
//TableColumn tc2_bottom = bjt.getColumnModel().getColumn(new_index);
//TableColumn tc = tjt.getColumnModel().getColumn(original_index);
//TableColumn tc2 = tjt.getColumnModel().getColumn(new_index);
//tc_bottom.setHeaderValue(tc.getHeaderValue());
//tc2_bottom.setHeaderValue(tc2.getHeaderValue());
//rm_conf.getLinkDataSource2().getDataColumn(tc_bottom.getModelIndex()).setIncludePosition(new_index);
//rm_conf.getLinkDataSource2().getDataColumn(tc2_bottom.getModelIndex()).setIncludePosition(original_index);
//removeAndReplaceTableColumns(bjt);
}
}
示例14: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
public void columnMoved(TableColumnModelEvent e) {
super.columnMoved(e);
if (e.getFromIndex() != e.getToIndex())
tree.doLayout();
}
示例15: columnMoved
import javax.swing.event.TableColumnModelEvent; //导入方法依赖的package包/类
@Override
public void columnMoved(TableColumnModelEvent e) {
if (e.getFromIndex() != e.getToIndex()) {
setModified(true);
}
}