|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.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 | |
|---|---|
protected static class |
DataTable.DefaultDataTableModel
|
class |
DataTable.NumberFormatDialog
|
protected static class |
DataTable.PrecisionRenderer
|
protected static class |
DataTable.RowNumberRenderer
|
protected static class |
DataTable.UnitRenderer
A cell renderer that adds units to displayed values. |
| Nested classes/interfaces inherited from class javax.swing.JTable |
|---|
javax.swing.JTable.AccessibleJTable, 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.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected int |
clickCountToSort
|
protected DataTable.NumberFormatDialog |
formatDialog
|
protected int |
labelColumnWidth
|
protected int |
minimumDataColumnWidth
|
protected java.util.HashMap<java.lang.String,DataTable.PrecisionRenderer> |
precisionRenderersByColumnName
|
static java.lang.String |
rowName
|
protected DataTable.RowNumberRenderer |
rowNumberRenderer
|
protected java.util.HashMap<java.lang.String,DataTable.UnitRenderer> |
unitRenderersByColumnName
|
| 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, autoCreateColumnsFromModel, autoResizeMode, cellEditor, cellSelectionEnabled, columnModel, dataModel, defaultEditorsByColumnClass, defaultRenderersByColumnClass, editingColumn, editingRow, editorComp, gridColor, preferredViewportSize, rowHeight, rowMargin, rowSelectionAllowed, selectionBackground, selectionForeground, selectionModel, showHorizontalLines, showVerticalLines, tableHeader |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, 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, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, print, print, print, print, print, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, 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, unconfigureEnclosingScrollPane, updateUI, valueChanged |
| Methods inherited from class javax.swing.JComponent |
|---|
addAncestorListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
|---|
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
|---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String rowName
protected java.util.HashMap<java.lang.String,DataTable.PrecisionRenderer> precisionRenderersByColumnName
protected java.util.HashMap<java.lang.String,DataTable.UnitRenderer> unitRenderersByColumnName
protected DataTable.RowNumberRenderer rowNumberRenderer
protected int labelColumnWidth
protected int minimumDataColumnWidth
protected DataTable.NumberFormatDialog formatDialog
protected int clickCountToSort
| Constructor Detail |
|---|
public DataTable()
public DataTable(DataTableModel model)
model - data model| Method Detail |
|---|
public void setMaximumFractionDigits(java.lang.String columnName,
int maximumFractionDigits)
maximumFractionDigits - maximum number of fraction digits to displaycolumnName - name of the column
public void setFormatPattern(java.lang.String columnName,
java.lang.String pattern)
pattern - the patterncolumnName - name of the column
public 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 numberpublic 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.JTablerow - 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.ActionListenerevt - 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 | ||||||||