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


Java TableModelEvent类代码示例

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


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

示例1: fireTableChange

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
/** Fires multiple table model events, setting the inMultiEvent flag
 * as appropriate. */
private void fireTableChange (TableModelEvent[] e) {
    //Event may be null for offscreen info, etc.
    if (e == null || e.length==0) {
        return;
    }
    
    TableModelListener[] listeners = getTableModelListeners();
    inMultiEvent = e.length > 1;
    //System.err.println("fireTableChange("+Arrays.toString(e)+")");
    try {
        for (int i=0; i < e.length; i++) {
            if (i == e.length-1) {
                inMultiEvent = false;
            }
            fireTableChange (e[i], listeners);
        }
    } finally {
        inMultiEvent = false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:EventBroadcaster.java

示例2: stateChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
public void stateChanged(ChangeEvent ce) {
	/** Reset format combo box **/
	if (((Integer) numOfVars.getValue()).intValue() == 0 || inputTable.getRowCount() == 0) {
		formatchooser.setSelectedIndex(-1);
	}
	/** Decrement number of variables shows by spinner **/
	if (((Integer) numOfVars.getValue()).intValue() < inputTable.getRowCount() && inputTable.getRowCount() > 0) {
		((JWatVariableInputTableModel) inputTable.getModel()).deleteRow(inputTable.getRowCount() - 1);
		inputTable.tableChanged(new TableModelEvent(inputTable.getModel()));
		formatchooser.setSelectedIndex(-1);
		return;
	}
	/** Add a variabile on spinner **/
	if (((Integer) numOfVars.getValue()).intValue() > inputTable.getRowCount()) {
		addVariable();
	}
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:18,代码来源:InputPanel.java

示例3: tableChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
public void tableChanged(TableModelEvent e) {
    
    // if the graph is disabled, do not handle any events.
        if ( _disableQBGF )
 return;
    
    // if the graph is being generated from model, do not handle events.
    if (_queryBuilder._updateModel == false)
 return;
    
    Log.getLogger().finest("Entering QBGF.tableChanged, source: " + e.getSource()); // NOI18N

    if (e.getSource() instanceof QueryBuilderTableModel)
        tableModelChanged(e);
    
    else if (e.getSource() instanceof QueryBuilderInputTableModel)
        inputTableModelChanged(e);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:QueryBuilderGraphFrame.java

示例4: showSubTabs

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
private void showSubTabs( int row, int col ) {
    this.selCol = col;
    this.selRow = row;
    int newRowCount = rowCount;
    selectedTopItem = null;
    if( selCol >= 0 ) {
        selectedTopItem = selCol == documentCol ? documents[selRow] : views[selRow];
        if( selectedTopItem.hasSubItems() ) {
            newRowCount = Math.max( rowCount, selectedTopItem.getActivatableSubItems().length+selRow);
        } else {
            selCol = -1;
            selRow = -1;
            selectedTopItem = null;
        }
    }
    if( documentCol >= 0 )
        fireTableChanged( new TableModelEvent( this, 0, getRowCount(), documentCol+1 ) );
    if( viewCol >= 0 )
        fireTableChanged( new TableModelEvent( this, 0, getRowCount(), viewCol+1 ) );
    int rowDelta = newRowCount - getRowCount();
    extraRows = newRowCount-rowCount;
    if( rowDelta < 0 )
        fireTableRowsDeleted( rowCount, rowCount-rowDelta );
    else if( rowDelta > 0 )
        fireTableRowsInserted( rowCount, rowCount+rowDelta );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:Model.java

示例5: fireTableColumnChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
/** Fires a TableModelEvent - change of one column */
public void fireTableColumnChanged(int index) {
    int columnModelIndex = index;
    
    // reset the header value as well
    Object list[] = listenerList.getListenerList();
    for (int i = 0; i < list.length; i++) {
        if (list[i] instanceof JTable) {
            JTable jt = (JTable)list[i];
            try {
                TableColumn column = jt.getColumnModel().getColumn(index);
                columnModelIndex = column.getModelIndex();
                column.setHeaderValue(jt.getModel().getColumnName(columnModelIndex));
            } catch (ArrayIndexOutOfBoundsException abe) {
                // only catch exception
            }
            jt.getTableHeader().repaint();
        }
    }
    fireTableChanged(new TableModelEvent(this, 0, getRowCount() - 1, columnModelIndex));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:PropertiesTableModel.java

示例6: setupTableModelListener

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
private void setupTableModelListener() {
//add listener which responds to tableChanged that is fired
//by variationPerParameterTableModel.setValueAt().
      this.variationPerParameterTableModel.addTableModelListener(new TableModelListener() {
      	public void tableChanged(TableModelEvent e) {
      		//update currentVariationFunctionContext.
      		Variation variationFunction = variationPerParameterTableModel.getUncertaintiesObject()
      			.getVariationFunction(variationPerParameterTableModel.getCurrentRow());
      		setCurrentVariationFunctionContext(new VariationFunctionContext(variationFunction));

      		//update panel.
      		updateVariationPerParameterSidePanel();

      		//select row of currentVariationFunctionContext.
      		int selectedRowIndex = variationPerParameterTableModel.getCurrentRow();
      		setSelectedRow(selectedRowIndex);
      	}
      });
  }
 
开发者ID:OpenDA-Association,项目名称:OpenDA,代码行数:20,代码来源:VariationPerParameterTableController.java

示例7: tMacrosTableChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
private void tMacrosTableChanged(final TableModelEvent evt) {
    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            if (evt.getType() == TableModelEvent.INSERT) {
                tMacros.getSelectionModel().setSelectionInterval(evt.getFirstRow(), evt.getFirstRow());
            } else if (evt.getType() == TableModelEvent.DELETE) {
                // try the next row after the deleted one
                int tableRow = evt.getLastRow();
                if (tableRow < tMacros.getModel().getRowCount()) {
                    tMacros.getSelectionModel().setSelectionInterval(tableRow, tableRow);
                } else {
                    // try the previous row
                    tableRow = evt.getFirstRow() - 1;
                    if (tableRow >= 0) {
                        tMacros.getSelectionModel().setSelectionInterval(tableRow, tableRow);
                    } else {
                        tMacros.getSelectionModel().clearSelection();
                    }
                }
            }
        }
    });
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:MacrosPanel.java

示例8: tableChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
@Override
public void tableChanged(TableModelEvent tme) {

	int seriesIndex = tme.getFirstRow();
	try{
		if(tme.getColumn() == 0){
			this.setSeriesLabel(seriesIndex, (String) this.chartSettingModel.getTableModelSeriesSettings().getValueAt(seriesIndex, 0));
		}else if(tme.getColumn() == 1){
			this.setSeriesColor(seriesIndex, (Color) this.chartSettingModel.getTableModelSeriesSettings().getValueAt(seriesIndex, 1));
		}else if(tme.getColumn() == 2){
			this.setSeriesLineWidth(seriesIndex, (Float) this.chartSettingModel.getTableModelSeriesSettings().getValueAt(seriesIndex, 2));
		}
		
	} catch (NoSuchSeriesException ex) {
		System.err.println("Error changing settings for series "+seriesIndex);
		ex.printStackTrace();
	}
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:19,代码来源:ChartSettingsTab.java

示例9: tableChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
public void tableChanged(TableModelEvent e) {
	// If a row changed and is a complete entry(both x and y values)
	// plot the points on the display.
	if(e.getType() == TableModelEvent.UPDATE) {
   		Object blank = "";
   		if(e.getFirstRow() != TableModelEvent.HEADER_ROW) {
    		if(tableModel.getValueAt(e.getFirstRow(), 0).equals(blank) == false &&
    		   tableModel.getValueAt(e.getFirstRow(), 1).equals(blank) == false) {
                updateAction.actionPerformed();
            }
   		}
	}
	// If a row is removed, remove it from the display.
   	else if(e.getType() == TableModelEvent.DELETE) {
           updateAction.actionPerformed();
   	}
}
 
开发者ID:etomica,项目名称:etomica,代码行数:18,代码来源:DevicePlotPoints.java

示例10: tableChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
public void tableChanged(TableModelEvent e) {

    		Object blank = "";

            if(e.getType() == TableModelEvent.UPDATE) {
            	if(e.getColumn() == TableModelEvent.ALL_COLUMNS) {
            		;
            	}
            	else if(e.getFirstRow() == TableModelEvent.HEADER_ROW) {
            		;
            	}
            	else {
		    		if(e.getFirstRow() == numRows-1) {
		    		    if(getValueAt(e.getFirstRow(), e.getColumn()).equals(blank) == false) {
		    		    	addEmptyRow();	
		    			}
		    		}
            	}
	    	}
            else if(e.getType() == TableModelEvent.DELETE) {
            }
    	}
 
开发者ID:etomica,项目名称:etomica,代码行数:23,代码来源:DeviceTableModelGeneric.java

示例11: update

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
/**
 * Updates region spinner and region list to reflect current blocking regions
 */
private void update() {
	regionsNumSpinner.setValue(new Integer(bd.getRegionKeys().size()));
	regions.tableChanged(new TableModelEvent(regions.getModel()));
	regions.repaint();
	if (bd.getRegionKeys().size() >= MAX_NUMBER_OF_REGIONS) {
		addRegion.setEnabled(false);
	} else {
		addRegion.setEnabled(true);
	}

	// Selects first blocking region if none selected and if present
	if (regions.getSelectedRow() < 0) {
		regions.getSelectionModel().setSelectionInterval(0, 0);
	}
}
 
开发者ID:HOMlab,项目名称:QN-ACTR-Release,代码行数:19,代码来源:AllBlockingRegionsPanel.java

示例12: sortByColumn

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
public void sortByColumn(int column, boolean ascending) {
    sortBy = column;
    this.ascending = ascending;
    sortingColumns.removeAllElements();
    sortingColumns.addElement(new Integer(column));
    sort(this);
    super.tableChanged(new TableModelEvent(this)); 
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:9,代码来源:TableSorter.java

示例13: tableChanged

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
@Override
public void tableChanged(TableModelEvent e) {
    System.out.println("Sorter: tableChanged");
    reallocateIndexes();

    super.tableChanged(e);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:TableSorter.java

示例14: addDataManagers

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
private void addDataManagers() {
	addModeButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			stopAllCellEditing();
			int index = stationData.getTransitionModeListSize(stationKey);
			stationData.addTransitionMode(stationKey, Defaults.get("transitionModeName") + (index + 1));
			OptionTable.tableChanged(new TableModelEvent(OptionTable.getModel()));
		}
	});
}
 
开发者ID:max6cn,项目名称:jmt,代码行数:12,代码来源:TimingSectionPanel.java

示例15: propertyChange

import javax.swing.event.TableModelEvent; //导入依赖的package包/类
public void propertyChange(PropertyChangeEvent evt) {
    // We get this event while editing
    stopCellEditingNoCommit();
    if( SwingUtilities.isEventDispatchThread() ) {
        outline.tableChanged(new TableModelEvent(outline.getModel(), 0, outline.getRowCount()));
    } else {
        SwingUtilities.invokeLater( new Runnable() {
            public void run() {
                outline.tableChanged(new TableModelEvent(outline.getModel(), 0, outline.getRowCount()));
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:SheetCell.java


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