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


Java TableModel.addTableModelListener方法代码示例

本文整理汇总了Java中javax.swing.table.TableModel.addTableModelListener方法的典型用法代码示例。如果您正苦于以下问题:Java TableModel.addTableModelListener方法的具体用法?Java TableModel.addTableModelListener怎么用?Java TableModel.addTableModelListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.table.TableModel的用法示例。


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

示例1: DefaultOutlineModel

import javax.swing.table.TableModel; //导入方法依赖的package包/类
/** Creates a new instance of DefaultOutlineModel.  <strong><b>Note</b> 
 * Do not fire table structure changes from the wrapped TableModel (value
 * changes are okay).  Changes that affect the number of rows must come
 * from the TreeModel.
 * @param treeModel The tree model
 * @param tableModel The table model
 * @param largeModel <code>true</code> if it's a large model tree, <code>false</code> otherwise.
 * @param nodesColumnLabel Label of the node's column
 */
protected DefaultOutlineModel(TreeModel treeModel, TableModel tableModel, boolean largeModel, String nodesColumnLabel) {
    this.treeModel = treeModel;
    this.tableModel = tableModel;
    if (nodesColumnLabel != null) {
        this.nodesColumnLabel = nodesColumnLabel;
    }
    
    layout = largeModel ? (AbstractLayoutCache) new FixedHeightLayoutCache() 
        : (AbstractLayoutCache) new VariableHeightLayoutCache();
        
    broadcaster = new EventBroadcaster (this);
    
    layout.setRootVisible(true);
    layout.setModel(this);
    treePathSupport = new TreePathSupport(this, layout);
    treePathSupport.addTreeExpansionListener(broadcaster);
    treePathSupport.addTreeWillExpandListener(broadcaster);
    treeModel.addTreeModelListener(broadcaster);
    tableModel.addTableModelListener(broadcaster);
    if (tableModel instanceof ProxyTableModel) {
        ((ProxyTableModel) tableModel).setOutlineModel(this);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:DefaultOutlineModel.java

示例2: setModel

import javax.swing.table.TableModel; //导入方法依赖的package包/类
@Override
@SuppressWarnings({"unchecked"})
public void setModel(TableModel dataModel) {
    if (!(dataModel instanceof DataViewTableUIModel)) {
        throw new IllegalArgumentException("DataViewTableUI only supports"
                + " instances of DataViewTableUIModel");
    }
    if (getModel() != null) {
        getModel().removeTableModelListener(dataChangedListener); // Remove ChangeListener on replace
    }
    super.setModel(dataModel);
    dataModel.addTableModelListener(dataChangedListener); // Add new change listener
    if (dataviewUI != null) {
        dataviewUI.handleColumnUpdated();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DataViewTableUI.java

示例3: getTableCellEditorComponent

import javax.swing.table.TableModel; //导入方法依赖的package包/类
@Override
public Component getTableCellEditorComponent(JTable table,
                                         Object value,
                                         boolean isSelected,
                                         int r, int c) {
   TableModel tableModel = outline.getModel();
   tableModel.addTableModelListener(this);
   return super.getTableCellEditorComponent(table, value, isSelected, r, c);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:SheetCell.java

示例4: PropertyEditorPanel

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public PropertyEditorPanel(Properties initalValue, boolean editable) {
    initComponents();
    this.value = initalValue;
    this.editable = editable;
    propertyTable.putClientProperty(
            "terminateEditOnFocusLost", Boolean.TRUE);              //NOI18N
    updateTableFromEditor();
    final TableModel tm = propertyTable.getModel();
    tm.addTableModelListener(new TableModelListener() {
        @Override
        public void tableChanged(TableModelEvent tme) {
            synchronized (PropertyEditorPanel.this) {
                if (updateing) {
                    return;
                }
                updateing = true;
                Properties p = new Properties();
                for (int i = 0; i < tm.getRowCount(); i++) {
                    p.setProperty((String) tm.getValueAt(i, 0), (String) tm.getValueAt(i, 1));
                }
                Properties oldValue = value;
                value = p;
                firePropertyChange(PROP_VALUE, oldValue, value);
                updateing = false;
            }
        }
    });
    propertyTable.getSelectionModel().addListSelectionListener(
            new ListSelectionListener() {
                @Override
                public void valueChanged(ListSelectionEvent lse) {
                    updateRemoveButtonSensible();
                }
            });
    updateAddButtonSensible();
    updateRemoveButtonSensible();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:PropertyEditorPanel.java

示例5: separateStaticImportsCheckBoxActionPerformed

import javax.swing.table.TableModel; //导入方法依赖的package包/类
private void separateStaticImportsCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_separateStaticImportsCheckBoxActionPerformed
    TableModel oldModel = importLayoutTable.getModel();
    TableModel newModel = (DefaultTableModel)createTableModel(importGroupsOrder, preferences);
    importLayoutTable.setModel(newModel);
    setImportLayoutTableColumnsWidth();
    for (TableModelListener l : ((DefaultTableModel)oldModel).getTableModelListeners()) {
        oldModel.removeTableModelListener(l);
        newModel.addTableModelListener(l);
        l.tableChanged(null);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:FmtImports.java

示例6: setModel

import javax.swing.table.TableModel; //导入方法依赖的package包/类
@Override
public void setModel(final TableModel model) {
	boolean shouldSort = this.sortable && checkIfSortable(model);

	if (shouldSort) {
		this.tableSorter = new ExtendedJTableSorterModel(model);
		this.tableSorter.setTableHeader(getTableHeader());
		super.setModel(this.tableSorter);
	} else {
		super.setModel(model);
		this.tableSorter = null;
	}

	originalOrder = new String[model.getColumnCount()];
	for (int c = 0; c < model.getColumnCount(); c++) {
		originalOrder[c] = model.getColumnName(c);
	}

	// initializing arrays for cell renderer settings
	cutOnLineBreaks = new boolean[model.getColumnCount()];
	maximalTextLengths = new int[model.getColumnCount()];
	Arrays.fill(maximalTextLengths, Integer.MAX_VALUE);

	model.addTableModelListener(new TableModelListener() {

		@Override
		public void tableChanged(final TableModelEvent e) {
			int oldLength = cutOnLineBreaks.length;
			if (oldLength != model.getColumnCount()) {
				cutOnLineBreaks = Arrays.copyOf(cutOnLineBreaks, model.getColumnCount());
				maximalTextLengths = Arrays.copyOf(maximalTextLengths, model.getColumnCount());
				if (oldLength < cutOnLineBreaks.length) {
					Arrays.fill(cutOnLineBreaks, oldLength, cutOnLineBreaks.length, false);
					Arrays.fill(maximalTextLengths, oldLength, cutOnLineBreaks.length, Integer.MAX_VALUE);
				}
			}
		}
	});
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:40,代码来源:ExtendedJTable.java

示例7: fillPropertiesTable

import javax.swing.table.TableModel; //导入方法依赖的package包/类
private void fillPropertiesTable(final Map<String, Object> properties) {
	final TableModel model = new PropertiesTableModel(properties);
	table.setModel(model);
	table.getSelectionModel().setSelectionMode(
			ListSelectionModel.SINGLE_SELECTION);
	model.addTableModelListener(table);
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:8,代码来源:SourceFilePropertiesDialog.java

示例8: subscribeActual

import javax.swing.table.TableModel; //导入方法依赖的package包/类
@Override
protected void subscribeActual(Observer<? super TableModelEvent> observer) {
    TableModel w = widget;

    TableModelEventConsumer aec = new TableModelEventConsumer(observer, w);
    observer.onSubscribe(aec);

    w.addTableModelListener(aec);
    if (aec.get() == null) {
        aec.onDispose(w);
    }
}
 
开发者ID:akarnokd,项目名称:RxJava2Swing,代码行数:13,代码来源:TableModelEventObservable.java

示例9: installFor

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public static void installFor(JTable table, JPopupMenu popupMenu, int column) {
    removeOldHeaderMouseListener(table);
    TableModel model = table.getModel();
    model.addTableModelListener(new HeaderCheckBoxHandler(table));
    table.getTableHeader().addMouseListener(new HeaderMouseListener(popupMenu, column));
    TableCellRenderer r = new HeaderRenderer(table.getTableHeader(), popupMenu, column);
    table.getColumnModel().getColumn(column).setHeaderRenderer(r);
    TableCellRenderer leftAlign = new LeftAlignHeaderRenderer();
    for (int i = 0; i < table.getColumnCount(); i++) {
        if (i != column) {
            table.getColumnModel().getColumn(i).setHeaderRenderer(leftAlign);
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:15,代码来源:TableCheckBoxColumn.java

示例10: setModel

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public void setModel(TableModel model) {
    this.model = model; 
    model.addTableModelListener(this); 
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:5,代码来源:TableMap.java

示例11: watch

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public void watch(TableModel m)
{
	m.addTableModelListener(listener);
}
 
开发者ID:equella,项目名称:Equella,代码行数:5,代码来源:ChangeDetector.java


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