本文整理匯總了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;
}
}
示例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();
}
}
示例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);
}
示例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 );
}
示例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));
}
示例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);
}
});
}
示例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();
}
}
}
}
});
}
示例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();
}
}
示例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();
}
}
示例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) {
}
}
示例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);
}
}
示例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));
}
示例13: tableChanged
import javax.swing.event.TableModelEvent; //導入依賴的package包/類
@Override
public void tableChanged(TableModelEvent e) {
System.out.println("Sorter: tableChanged");
reallocateIndexes();
super.tableChanged(e);
}
示例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()));
}
});
}
示例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()));
}
});
}
}