|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JTable org.opensourcephysics.display.DataTable
public class DataTable
DataTable displays multiple TableModels in a table. The first TableModel usually contains the independent variable for the other TableModel so that the visibility of column[0] can be set to false for subsequent TableModels.
Nested Class Summary | |
---|---|
class |
DataTable.NumberFormatDialog
|
Nested classes/interfaces inherited from class javax.swing.JTable |
---|
javax.swing.JTable.DropLocation, javax.swing.JTable.PrintMode |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.BaselineResizeBehavior |
Field Summary | |
---|---|
static java.lang.String |
rowName
|
Fields inherited from class javax.swing.JTable |
---|
AUTO_RESIZE_ALL_COLUMNS, AUTO_RESIZE_LAST_COLUMN, AUTO_RESIZE_NEXT_COLUMN, AUTO_RESIZE_OFF, AUTO_RESIZE_SUBSEQUENT_COLUMNS |
Fields inherited from class javax.swing.JComponent |
---|
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
DataTable()
Constructs a DatTable with a default data model |
|
DataTable(DataTableModel model)
Constructs a DatTable with the specified data model |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent evt)
Performs the action for the refresh timer by refreshing the data in the DataTable. |
void |
add(javax.swing.table.TableModel tableModel)
Add a TableModel object to the table model list. |
void |
clear()
Remove all TableModels from the table model list. |
javax.swing.table.TableCellRenderer |
getCellRenderer(int row,
int column)
Returns an appropriate renderer for the cell specified by this row and column. |
DataTable.NumberFormatDialog |
getFormatDialog(java.lang.String[] names,
java.lang.String[] selected)
Gets the format setter dialog. |
java.lang.String |
getFormatPattern(java.lang.String columnName)
Gets the formatting pattern for a named column |
java.lang.String[] |
getFormattedColumnNames()
Gets the names of formatted columns Added by D Brown 24 Apr 2011 |
java.lang.Object |
getFormattedValueAt(int row,
int col)
Gets the formatted value at a given row and column. |
int |
getMaximumFractionDigits()
Gets the maximum number of digits in the table. |
javax.swing.table.TableCellRenderer |
getPrecisionRenderer(java.lang.String columnName)
Gets the precision renderer, if any, for a given columnn name. |
int |
getSortedColumn()
Gets the sorted column. |
boolean |
isRowNumberVisible()
Gets the display row number flag. |
void |
refreshTable()
Refresh the data in the DataTable, as well as other changes to the table, such as row number visibility. |
void |
remove(javax.swing.table.TableModel tableModel)
Remove a TableModel object from the table model list. |
void |
setColumnVisible(javax.swing.table.TableModel tableModel,
int columnIndex,
boolean b)
Sets the visibility of a column of a TableModel in the DataTable. |
void |
setFormatPattern(java.lang.String columnName,
java.lang.String pattern)
Sets the formatting pattern for a named column |
void |
setMaximumFractionDigits(int maximumFractionDigits)
Sets the maximum number of fraction digits to display for cells that have type Double |
void |
setMaximumFractionDigits(java.lang.String columnName,
int maximumFractionDigits)
Sets the maximum number of fraction digits to display in a named column |
void |
setModel(DataTableModel _model)
Sets the model for this data table; |
void |
setRefreshDelay(int delay)
Sets the delay time for table refresh timer. |
void |
setRowNumberVisible(boolean _rowNumberVisible)
Sets the display row number flag. |
void |
setStride(javax.swing.table.TableModel tableModel,
int stride)
Sets the stride of a TableModel in the DataTable. |
void |
setUnits(java.lang.String columnName,
java.lang.String units,
java.lang.String tooltip)
Sets the units and tooltip for a named column. |
void |
sort(int col)
Sorts the table using the given column. |
Methods inherited from class javax.swing.JTable |
---|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnsFromModel, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getFillsViewportHeight, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getPrintable, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, getValueAt, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, prepareEditor, prepareRenderer, print, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, tableChanged, updateUI, valueChanged |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static java.lang.String rowName
Constructor Detail |
---|
public DataTable()
public DataTable(DataTableModel model)
model
- data modelMethod Detail |
---|
public void setMaximumFractionDigits(java.lang.String columnName, int maximumFractionDigits)
maximumFractionDigits
- maximum number of fraction digits to displaycolumnName
- name of the columnpublic void setFormatPattern(java.lang.String columnName, java.lang.String pattern)
pattern
- the patterncolumnName
- name of the columnpublic void setUnits(java.lang.String columnName, java.lang.String units, java.lang.String tooltip)
columnName
- name of the columnunits
- the units string (may be null)tootip
- the tooltip (may be null)public java.lang.String getFormatPattern(java.lang.String columnName)
columnName
- name of the column
public java.lang.String[] getFormattedColumnNames()
public java.lang.Object getFormattedValueAt(int row, int col)
row
- the row numbercol
- the column number
public DataTable.NumberFormatDialog getFormatDialog(java.lang.String[] names, java.lang.String[] selected)
names
- the column name choicesselected
- the initially selected names
public void sort(int col)
col
- intpublic int getSortedColumn()
public void setMaximumFractionDigits(int maximumFractionDigits)
maximumFractionDigits
- - maximum number of fraction digits to displaypublic int getMaximumFractionDigits()
public void setRowNumberVisible(boolean _rowNumberVisible)
_rowNumberVisible
- true<\code> if table display row number
public void setModel(DataTableModel _model)
_model
- public void setStride(javax.swing.table.TableModel tableModel, int stride)
tableModel
- stride
- public void setColumnVisible(javax.swing.table.TableModel tableModel, int columnIndex, boolean b)
tableModel
- columnIndex
- b
- public boolean isRowNumberVisible()
public javax.swing.table.TableCellRenderer getCellRenderer(int row, int column)
TableColumn
for this column has a non-null
renderer, returns that. If the TableColumn
for this column has
the same name as a name specified in the setMaximumFractionDigits method,
returns the appropriate renderer. If not, finds the class of the data in
this column (using getColumnClass
) and returns the default
renderer for this type of data.
getCellRenderer
in class javax.swing.JTable
row
- Description of Parametercolumn
- Description of Parameter
public javax.swing.table.TableCellRenderer getPrecisionRenderer(java.lang.String columnName)
columnName
- the name
public void setRefreshDelay(int delay)
delay
- the delay in millisecondpublic void refreshTable()
public void actionPerformed(java.awt.event.ActionEvent evt)
actionPerformed
in interface java.awt.event.ActionListener
evt
- public void add(javax.swing.table.TableModel tableModel)
tableModel
- public void remove(javax.swing.table.TableModel tableModel)
tableModel
- public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |