當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。