当前位置: 首页>>代码示例>>Java>>正文


Java TableColumnModelEvent类代码示例

本文整理汇总了Java中javax.swing.event.TableColumnModelEvent的典型用法代码示例。如果您正苦于以下问题:Java TableColumnModelEvent类的具体用法?Java TableColumnModelEvent怎么用?Java TableColumnModelEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TableColumnModelEvent类属于javax.swing.event包,在下文中一共展示了TableColumnModelEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: columnAdded

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
@Override
public void columnAdded(TableColumnModelEvent e) {
	LinesTableColumn type = getColumnType(e.getToIndex());
	TableColumn column = getColumnModel().getColumn(e.getToIndex());
	switch (type) {
		case COLOR:
			column.setMaxWidth(25);
			break;
		case CLASS:
			column.setPreferredWidth(90);
			break;
		case STATION:
			column.setPreferredWidth(90);
			break;
		case ALGORITHM:
			column.setPreferredWidth(100);
			break;
	}
	super.columnAdded(e);
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:21,代码来源:GraphPanel.java

示例2: 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);
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:27,代码来源:TableColumnModelSynchronizer.java

示例3: columnAdded

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
public void columnAdded(TableColumnModelEvent event)
   {
super.columnAdded(event);
TableColumn column = getColumnModel().getColumn(event.getToIndex());
column.setCellRenderer(cellRenderer);
AlignerTree aligner = getAlignerTree();
if(synchronizer != null &&
   aligner != null) {
    synchronizer.add(aligner);
    synchronizer = null;
}

TableCellRenderer r = column.getHeaderRenderer();
if(r instanceof TreeHeaderRenderer) {
    JTree tree = ((TreeHeaderRenderer)r).getTree();
    if(!(tree instanceof AlignerTree) &&
       aligner != null)
	aligner.addTree((NameTree)tree);
    resizeAndRepaint();
}
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:22,代码来源:NameTreeTable.java

示例4: columnRemoved

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
public void columnRemoved(TableColumnModelEvent event)
   {
AlignerTree atree = getAlignerTree();
if(atree != null) {
    List<JTree> renderers = atree.getTrees();
    
    Enumeration<TableColumn> e =
	getColumnModel().getColumns();
    
    while(e.hasMoreElements()) {
	TableCellRenderer r =
	    e.nextElement().getHeaderRenderer();
	if(renderers.contains(r))
	    renderers.remove(r);
    }
    
    for(JTree tree: renderers) {
	atree.removeTree((NameTree)tree);
    }
    
    renderers.clear();
}

super.columnRemoved(event);
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:26,代码来源:NameTreeTable.java

示例5: moveColumn

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
public void moveColumn(final int columnIndex, final int newIndex) {
    if (columnIndex < 0 || columnIndex >= getColumnCount()
        || newIndex < 0 || newIndex > getColumnCount()) {

        throw new IllegalArgumentException(Messages.getString("swing.79")); //$NON-NLS-1$
    }

    if (columnIndex != newIndex) {
        TableColumn firstColumn = getColumn(columnIndex);
        tableColumns.remove(columnIndex);
        tableColumns.add(newIndex, firstColumn);

        boolean oldIsSelected = selectionModel.isSelectedIndex(columnIndex);
        selectionModel.removeIndexInterval(columnIndex, columnIndex);
        selectionModel.insertIndexInterval(newIndex, 1, true);
        if (oldIsSelected) {
            selectionModel.addSelectionInterval(newIndex, newIndex);
        } else {
            selectionModel.removeSelectionInterval(newIndex, newIndex);
        }
    }

    fireColumnMoved(new TableColumnModelEvent(this, columnIndex, newIndex));
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:DefaultTableColumnModel.java

示例6: moveColumn

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
@Override
	public void moveColumn(int viewFrom, int viewTo) {
//		viewToModelMap
		columnMap.get(viewToModelMap.get(viewFrom)).setOrder(viewTo);
		if(viewFrom < viewTo) {
			for (int i = viewFrom + 1; i <= viewTo; i++) {
				columnMap.get(viewToModelMap.get(i)).setOrder(i-1);
			}
			reorderViewColumns(true);
		}else if(viewFrom > viewTo){
			for (int i = viewFrom-1; i >= viewTo; i--) {
				columnMap.get(viewToModelMap.get(i)).setOrder(i+1);
			}
			reorderViewColumns(true);
		}else{
			//no change
		}
		this.fireColumnMoved(new TableColumnModelEvent(this, viewFrom, viewTo));
	}
 
开发者ID:nccgroup,项目名称:BurpSuiteLoggerPlusPlus,代码行数:20,代码来源:LogTableColumnModel.java

示例7: moveColumn

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
public void moveColumn(int fromIndex, int toIndex) {

        if (!MainFrame.getInstance().canNavigateAway())
            return;
        MainFrame.getInstance().updateDesignationDisplay();
        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<TableColumnModelListener>(watchers)) {
            w.columnMoved(new TableColumnModelEvent(this, fromIndex, toIndex));
        }
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:21,代码来源:SorterTableColumnModel.java

示例8: 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());
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:17,代码来源:PlacemarkManagerTopComponent.java

示例9: addColumn

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
/** Copy of addColumn(TableColumn) with an index specifying where to add the new column */
   private void addColumn(TableColumn aColumn, int index) {
if (aColumn == null) {
    throw new IllegalArgumentException("Object is null");
}

tableColumns.insertElementAt(aColumn, index);
aColumn.addPropertyChangeListener(this);
//invalidateWidthCache();
       totalColumnWidth = -1;

// Post columnAdded event notification
fireColumnAdded(new TableColumnModelEvent(this, 0, index));
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ETableColumnModel.java

示例10: 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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:IssueTable.java

示例11: columnAdded

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
@Override
public void columnAdded(TableColumnModelEvent e) {
	super.columnAdded(e);
	// bigger default size
	TableColumn column = getColumnModel().getColumn(getColumnModel().getColumnCount() - 1);
	column.setPreferredWidth(COLUMN_WIDTH);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:AttributeEditor.java

示例12: columnMoved

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
/** Necessary to properly stopping the editing when a column is moved (dragged). */
@Override
public void columnMoved(final TableColumnModelEvent e) {
	if (isEditing()) {
		cellEditor.stopCellEditing();
	}
	super.columnMoved(e);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:9,代码来源:ExtendedJTable.java

示例13: columnMoved

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
/**
 * Overridden to fix 
 * //http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4330950:
 */ 
@Override
public void columnMoved(TableColumnModelEvent e) {
  if (isEditing()) {
      cellEditor.stopCellEditing();
  }
  super.columnMoved(e);
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:12,代码来源:XJTable.java

示例14: columnAdded

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
/**
 * Maps {@code JTable.columnAdded(TableColumnModelEvent)} through queue
 */
public void columnAdded(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnAdded") {
        @Override
        public void map() {
            ((JTable) getSource()).columnAdded(tableColumnModelEvent);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JTableOperator.java

示例15: columnMoved

import javax.swing.event.TableColumnModelEvent; //导入依赖的package包/类
/**
 * Maps {@code JTable.columnMoved(TableColumnModelEvent)} through queue
 */
public void columnMoved(final TableColumnModelEvent tableColumnModelEvent) {
    runMapping(new MapVoidAction("columnMoved") {
        @Override
        public void map() {
            ((JTable) getSource()).columnMoved(tableColumnModelEvent);
        }
    });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:JTableOperator.java


注:本文中的javax.swing.event.TableColumnModelEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。