|
|||||||||||
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 edu.umd.cfar.lamp.apploader.misc.EnhancedTable
Provides a JTable with some higher-level functionality than the standard Swing version. This includes listeners for each cell (instead of having to add a mouse listener and then check what cell it is over).
Nested Class Summary |
Nested classes inherited from class javax.swing.JTable |
javax.swing.JTable.AccessibleJTable |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary |
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 | |
EnhancedTable()
Create a new, empty table. |
|
EnhancedTable(int numRows,
int numColumns)
Create a new table with the given number of columns and rows. |
|
EnhancedTable(java.lang.Object[][] rowData,
java.lang.Object[] columnNames)
Creates a new table using the default table model cell renderers, using the given array to populate the model. |
|
EnhancedTable(javax.swing.table.TableModel dm)
Creates a new table from the given table model. |
|
EnhancedTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm)
Create a new table with the given data model and title data model. |
|
EnhancedTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm,
javax.swing.ListSelectionModel sm)
Create a new table with the given table data, column, and selection models. |
|
EnhancedTable(java.util.Vector rowData,
java.util.Vector columnNames)
Creates a new default table model for a new table using the given vector-of-vectors for the data and the vector-of-titles for the titles. |
Method Summary | |
void |
addComponentListener(java.awt.event.ComponentListener l)
This is a total hack to handle scroll panes. |
void |
addTableListener(TableListener tl)
Add a TableListener |
void |
doLayout()
|
java.awt.Color |
getCellSelectionBackground()
|
java.awt.Color |
getCellSelectionForeground()
|
java.lang.String |
getColumnWidthDescription()
Gets the description of the current set of widths, and how they were set. |
int |
getMinimumNaturalColumnWidth()
Gets the minimum width that each column will be allowed to auto-resize to. |
TableListener[] |
getTableListeners()
Gets all table listeners attached to the table. |
void |
removeComponentListener(java.awt.event.ComponentListener l)
|
void |
removeTableListener(TableListener tl)
Removes the given table listener, if it is among the ones attached. |
void |
resizeAllColumnsToNaturalWidth()
Resizes all columns to the preferred width of their contents. |
void |
resizeAllRowsToNaturalHeight()
Set the row heights to the maximum preferred height of each row. |
void |
resizeColumnToNaturalWidth(int col)
Resizes the given column to the maximum preferred width of its cells. |
void |
resizeRowToNaturalHeight(int row)
Resizes the given row to the maximum preferred height of its contents. |
void |
setCellSelectionBackground(java.awt.Color cellSelectionBackground)
|
void |
setCellSelectionForeground(java.awt.Color cellSelectionForeground)
|
void |
setColumnWidthsFromDescription(java.lang.String description)
Deserialize the column widths. |
void |
setMinimumNaturalColumnWidth(int i)
Sets the minimum allowed width for auto-resize. |
void |
setRowHeightToMaximumPreferredHeight()
Sets the row heights to be the maximum preferred height of all cells. |
Methods inherited from class javax.swing.JTable |
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, configureEnclosingScrollPane, convertColumnIndexToModel, convertColumnIndexToView, createDefaultColumnModel, createDefaultColumnsFromModel, createDefaultDataModel, createDefaultEditors, createDefaultRenderers, createDefaultSelectionModel, createDefaultTableHeader, createScrollPaneForTable, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellRenderer, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPreferredScrollableViewportSize, getRowCount, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getValueAt, initializeLocalVars, isCellEditable, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, paramString, prepareEditor, prepareRenderer, processKeyBinding, removeColumn, removeColumnSelectionInterval, removeEditor, removeNotify, removeRowSelectionInterval, resizeAndRepaint, rowAtPoint, selectAll, setAutoCreateColumnsFromModel, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setEditingColumn, setEditingRow, setGridColor, setIntercellSpacing, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setValueAt, sizeColumnsToFit, sizeColumnsToFit, tableChanged, unconfigureEnclosingScrollPane, updateUI, valueChanged |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, 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, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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 |
Constructor Detail |
public EnhancedTable()
public EnhancedTable(int numRows, int numColumns)
numRows
- The height of the table (in cells)numColumns
- The width of the table (in cells)public EnhancedTable(javax.swing.table.TableModel dm)
dm
- The data modelpublic EnhancedTable(java.lang.Object[][] rowData, java.lang.Object[] columnNames)
rowData
- The data itemscolumnNames
- The titles for the columnspublic EnhancedTable(java.util.Vector rowData, java.util.Vector columnNames)
rowData
- The data, rowwise.columnNames
- The names for each columnpublic EnhancedTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm)
dm
- The data model for the table.cm
- The model for the columnspublic EnhancedTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm, javax.swing.ListSelectionModel sm)
dm
- The data modelcm
- The column modelsm
- The selection modelMethod Detail |
public void addTableListener(TableListener tl)
addTableListener
in interface ListenableTable
tl
- the new listener to add.public TableListener[] getTableListeners()
getTableListeners
in interface ListenableTable
public void removeTableListener(TableListener tl)
removeTableListener
in interface ListenableTable
tl
- The listener to remove.public void resizeAllColumnsToNaturalWidth()
public void setRowHeightToMaximumPreferredHeight()
public void resizeAllRowsToNaturalHeight()
setRowHeightToMaximumPreferredHeight()
.
This involves enumerating all cells in the table and checking
their preferred sizes.
public void resizeColumnToNaturalWidth(int col)
col
- the column to resizepublic void resizeRowToNaturalHeight(int row)
row
- the row to resizepublic int getMinimumNaturalColumnWidth()
public void setMinimumNaturalColumnWidth(int i)
i
- the new minimum allowed widthpublic java.lang.String getColumnWidthDescription()
public void setColumnWidthsFromDescription(java.lang.String description)
description
- the widthspublic void addComponentListener(java.awt.event.ComponentListener l)
Component.addComponentListener(java.awt.event.ComponentListener)
public void removeComponentListener(java.awt.event.ComponentListener l)
Component.removeComponentListener(java.awt.event.ComponentListener)
public void doLayout()
JTable.doLayout()
public java.awt.Color getCellSelectionBackground()
public void setCellSelectionBackground(java.awt.Color cellSelectionBackground)
cellSelectionBackground
- The cellSelectionBackground to set.public java.awt.Color getCellSelectionForeground()
public void setCellSelectionForeground(java.awt.Color cellSelectionForeground)
cellSelectionForeground
- The cellSelectionForeground to set.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |