|
||||||||||
| 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.jdesktop.swingx.JXTable
public class JXTable
A JXTable is a JTable with built-in support for row sorting, filtering, and
highlighting, column visibility and a special popup control on the column
header for quick access to table configuration. You can instantiate a JXTable
just as you would a JTable, using a TableModel. However, a JXTable
automatically wraps TableColumns inside a TableColumnExt instance.
TableColumnExt supports visibility, sortability, and prototype values for
column sizing, none of which are available in TableColumn. You can retrieve
the TableColumnExt instance for a column using getColumnExt(Object)
or getColumnExt(int colnumber).
A JXTable is, by default, sortable by clicking on column headers; each
subsequent click on a header reverses the order of the sort, and a sort arrow
icon is automatically drawn on the header. Sorting can be disabled using
setSortable(boolean). Sorting on columns is handled by a Sorter
instance which contains a Comparator used to compare values in two rows of a
column. You can replace the Comparator for a given column by using
getColumnExt("column").setComparator(customComparator)
Columns can be hidden or shown by setting the visible property on the
TableColumnExt using TableColumnExt.setVisible(boolean). Columns can
also be shown or hidden from the column control popup.
The column control popup is triggered by an icon drawn to the far right of
the column headers, above the table's scrollbar (when installed in a
JScrollPane). The popup allows the user to select which columns should be
shown or hidden, as well as to pack columns and turn on horizontal scrolling.
To show or hide the column control, use the
setColumnControlVisible(boolean show)method.
Rows can be filtered from a JXTable using a Filter class and a
FilterPipeline. One assigns a FilterPipeline to the table using
setFilters(FilterPipeline). Filtering hides, but does not delete or
permanently remove rows from a JXTable. Filters are used to provide sorting
to the table--rows are not removed, but the table is made to believe rows in
the model are in a sorted order.
One can automatically highlight certain rows in a JXTable by attaching Highlighters with setHighlighters(Highlighter) method. An example would be a Highlighter that colors alternate rows in the table for readability. The HighlighterFactory has several methods to return appropriate Highlighters for this use-case.s Again, like Filters, Highlighters can be chained together in a CompoundHighlighter to achieve more interesting effects.
You can resize all columns, selected columns, or a single column using the
methods like packAll(). Packing combines several other aspects of a
JXTable. If horizontal scrolling is enabled using
setHorizontalScrollEnabled(boolean), then the scrollpane will allow
the table to scroll right-left, and columns will be sized to their preferred
size. To control the preferred sizing of a column, you can provide a
prototype value for the column in the TableColumnExt using
TableColumnExt.setPrototypeValue(Object). The prototype is used as
an indicator of the preferred size of the column. This can be useful if some
data in a given column is very long, but where the resize algorithm would
normally not pick this up.
JXTable guarantees to delegate creation and configuration of TableColumnExt
to a ColumnFactory. By default, the application-wide shared ColumnFactory is used.
You can install a custom ColumnFactory, either application-wide by
ColumnFactory.setInstance(ColumnFactory) or per table instance by
setColumnFactory(ColumnFactory).
Last, you can also provide searches on a JXTable using the Searchable property.
Keys/Actions registered with this component:
HORIZONTALSCROLL_ACTION_COMMAND - toggle the horizontal scrollbar
PACKSELECTED_ACTION_COMMAND - resize the selected column to fit the widest
cell content
PACKALL_ACTION_COMMAND - resize all columns to fit the widest
cell content in each column
Key bindings.
Client Properties.
MATCH_HIGHLIGHTER - set to Boolean.TRUE to
use a SearchHighlighter to mark a cell as matching.
| Nested Class Summary | |
|---|---|
static class |
JXTable.BooleanEditor
The default editor for Boolean types. |
static class |
JXTable.GenericEditor
Default editor registered for Object. |
static class |
JXTable.NumberEditor
Editor for Numbers. |
| 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 |
FOCUS_NEXT_COMPONENT
|
static java.lang.String |
FOCUS_PREVIOUS_COMPONENT
|
static java.lang.String |
HORIZONTALSCROLL_ACTION_COMMAND
Identifier of show horizontal scroll action, used in JXTable's ActionMap. |
static java.lang.String |
MATCH_HIGHLIGHTER
key for client property to use SearchHighlighter as match marker. |
static java.lang.String |
PACKALL_ACTION_COMMAND
Identifier of pack table action, used in JXTable's ActionMap. |
static java.lang.String |
PACKSELECTED_ACTION_COMMAND
Identifier of pack selected column action, used in JXTable's ActionMap. |
static java.lang.String |
UIPREFIX
The prefix marker to find table related properties in the ResourceBundle. |
static java.lang.String |
USE_DTCR_COLORMEMORY_HACK
The key for the client property deciding about whether the color memory hack for DefaultTableCellRenderer should be used. |
| 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 | |
|---|---|
JXTable()
Instantiates a JXTable with a default table model, no data. |
|
JXTable(int numRows,
int numColumns)
Instantiates a JXTable for a given number of columns and rows. |
|
JXTable(java.lang.Object[][] rowData,
java.lang.Object[] columnNames)
Instantiates a JXTable with data in a array or rows and column names. |
|
JXTable(javax.swing.table.TableModel dm)
Instantiates a JXTable with a specific table model. |
|
JXTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm)
Instantiates a JXTable with a specific table model. |
|
JXTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm,
javax.swing.ListSelectionModel sm)
Instantiates a JXTable with a specific table model, column model, and selection model. |
|
JXTable(java.util.Vector rowData,
java.util.Vector columnNames)
Instantiates a JXTable with data in a vector or rows and column names. |
|
| Method Summary | |
|---|---|
void |
addHighlighter(Highlighter highlighter)
Appends a Highlighter to the end of the list of used
Highlighters. |
void |
columnMarginChanged(javax.swing.event.ChangeEvent e)
Overridden to support enhanced auto-resize behaviour enabled and necessary. |
void |
columnPropertyChange(java.beans.PropertyChangeEvent event)
Notifies listeners about property changes of contained columns. |
void |
columnRemoved(javax.swing.event.TableColumnModelEvent e)
overridden to remove the interactive sorter if the sorted column is no longer contained in the ColumnModel. |
void |
columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Overridden to update the enabled state of the pack selected column Action. |
int |
convertRowIndexToModel(int row)
Convert row index from view coordinates to model coordinates accounting for the presence of sorters and filters. |
int |
convertRowIndexToView(int row)
Convert row index from model coordinates to view coordinates accounting for the presence of sorters and filters. |
void |
createDefaultColumnsFromModel()
Creates, configures and adds default TableColumns for
columns in this table's TableModel. |
void |
doLayout()
Layouts column width. |
boolean |
editCellAt(int row,
int column,
java.util.EventObject e)
overridden to install a custom editor remover. |
boolean |
getAutoCreateColumnsFromModel()
Overridden for documentation clarification. |
javax.swing.table.TableCellRenderer |
getCellRenderer(int row,
int column)
Overridden to fix core bug #4614616 (NPE if TableModel's
Class for the column is an interface). |
javax.swing.table.TableColumn |
getColumn(int viewColumnIndex)
Returns the TableColumn at view position
columnIndex. |
javax.swing.JComponent |
getColumnControl()
Returns the component used as column control. |
int |
getColumnCount(boolean includeHidden)
Returns the number of contained columns. |
TableColumnExt |
getColumnExt(int viewColumnIndex)
Returns the TableColumnExt at view position
columnIndex. |
TableColumnExt |
getColumnExt(java.lang.Object identifier)
Returns the first TableColumnExt with the given
identifier. |
ColumnFactory |
getColumnFactory()
Returns the ColumnFactory. |
int |
getColumnMargin()
Returns the margin between columns. |
java.util.List<javax.swing.table.TableColumn> |
getColumns()
Returns a List of visible TableColumns. |
java.util.List<javax.swing.table.TableColumn> |
getColumns(boolean includeHidden)
Returns a List of contained TableColumns. |
boolean |
getFillsViewportHeight()
Returns the flag which controls the scrollableTracksViewportHeight property. |
FilterPipeline |
getFilters()
Returns the FilterPipeline for the table. |
Highlighter[] |
getHighlighters()
Returns the Highlighters used by this table. |
javax.swing.table.TableCellRenderer |
getNewDefaultRenderer(java.lang.Class<?> columnClass)
Returns a new instance of the default renderer for the specified class. |
java.awt.Dimension |
getPreferredScrollableViewportSize()
Overridden to support auto-calculation of pref scrollable size, dependent on the visible row/column count properties. |
int |
getRowCount()
Returns the row count in the table; if filters are applied, this is the filtered row count. |
boolean |
getScrollableTracksViewportHeight()
Overridden to control the tracksHeight property depending on fillsViewportHeight and relative size to containing parent. |
boolean |
getScrollableTracksViewportWidth()
Overridden to support enhanced auto-resize behaviour enabled and necessary. |
Searchable |
getSearchable()
|
SelectionMapper |
getSelectionMapper()
|
int |
getSelectionMode()
Returns the selection mode used by this table's selection model. |
javax.swing.table.TableColumn |
getSortedColumn()
|
SortOrder |
getSortOrder(int columnIndex)
Returns the SortOrder of the given column. |
SortOrder |
getSortOrder(java.lang.Object identifier)
Returns the SortOrder of the given column. |
java.lang.String |
getStringAt(int row,
int column)
Returns the string representation of the cell value at the given position. |
java.lang.Object |
getValueAt(int row,
int column)
Overridden to account for row index mapping. |
int |
getVisibleColumnCount()
Returns the preferred number of columns to show in the JScrollPane. |
int |
getVisibleRowCount()
Returns the preferred number of rows to show in a JScrollPane. |
boolean |
isAutoStartEditOnKeyStroke()
Returns the autoStartsEdit property. |
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at row and column
is editable. |
boolean |
isColumnControlVisible()
Returns the column control visible property. |
boolean |
isEditable()
Returns the editable property of the JXTable as a whole. |
boolean |
isFocusCycleRoot()
Overridden to prevent spurious focus loss to outside of table while removing the editor. |
boolean |
isHorizontalScrollEnabled()
Returns the current setting for horizontal scrolling. |
boolean |
isRolloverEnabled()
Returns the rolloverEnabled property. |
boolean |
isRowHeightEnabled()
Returns a boolean to indicate whether individual row height is enabled. |
boolean |
isSortable()
Returns the table's sortable property. |
boolean |
isTerminateEditOnFocusLost()
Returns the property which determines the edit termination behaviour on focus lost. |
void |
packAll()
Resizes all columns to fit their content. |
void |
packColumn(int column,
int margin)
Packs an indivudal column in the table. |
void |
packColumn(int column,
int margin,
int max)
Packs an indivual column in the table to less than or equal to the maximum witdth. |
void |
packSelected()
Resizes the lead column to fit its content. |
void |
packTable(int margin)
Packs all the columns to their optimal size. |
java.awt.Component |
prepareEditor(javax.swing.table.TableCellEditor editor,
int row,
int column)
Overridden to adjust the editor's component orientation. |
java.awt.Component |
prepareRenderer(javax.swing.table.TableCellRenderer renderer,
int row,
int column)
Returns the decorated Component used as a stamp to render
the specified cell. |
void |
removeEditor()
Overridden with backport from Mustang fix for #4684090, #4887999. |
void |
removeHighlighter(Highlighter highlighter)
Removes the given Highlighter. |
void |
removeNotify()
Overridden to uninstall the custom editor remover. |
void |
resetSortOrder()
Resets sorting of all columns. |
int |
rowAtPoint(java.awt.Point point)
Overridden to work around core Bug (ID #6291631): negative y is mapped to row 0). |
void |
scrollCellToVisible(int row,
int column)
Scrolls to make the cell at row and column visible. |
void |
scrollColumnToVisible(int column)
Scrolls horizontally to make the given column visible. |
void |
scrollRowToVisible(int row)
Scrolls vertically to make the given row visible. |
void |
setAutoResizeMode(int mode)
Overridden for internal bookkeeping related to the enhanced auto-resize behaviour. |
void |
setAutoStartEditOnKeyStroke(boolean autoStart)
Sets the autoStartsEdit property. |
void |
setColumnControl(javax.swing.JComponent columnControl)
Sets the component used as column control. |
void |
setColumnControlVisible(boolean visible)
Sets the column control visible property. |
void |
setColumnFactory(ColumnFactory columnFactory)
Sets the ColumnFactory to use for column creation and
configuration. |
void |
setColumnMargin(int value)
Sets the margin between columns. |
void |
setColumnSequence(java.lang.Object[] identifiers)
Reorders the columns in the sequence given array. |
void |
setComponentOrientation(java.awt.ComponentOrientation o)
Sets the language-sensitive orientation that is to be used to order the elements or text within this component. |
void |
setEditable(boolean editable)
Sets the editable property. |
void |
setFillsViewportHeight(boolean fillsViewportHeight)
Sets the flag which controls the scrollableTracksViewportHeight property. |
void |
setFilters(FilterPipeline pipeline)
Sets the FilterPipeline for filtering table rows, maybe null to remove all previously applied filters. |
void |
setGridColor(java.awt.Color gridColor)
Overridden because super throws NPE on null param. |
void |
setHighlighters(Highlighter... highlighters)
Sets the Highlighters to the table, replacing any old settings. |
void |
setHorizontalScrollEnabled(boolean enabled)
Sets the enablement of enhanced horizontal scrolling. |
void |
setLocale(java.util.Locale locale)
Overridden to update locale-dependent properties. |
void |
setModel(javax.swing.table.TableModel newModel)
|
void |
setPreferredScrollableViewportSize(java.awt.Dimension size)
If the given dimension is null, the auto-calculation of the pref scrollable size is enabled, otherwise the behaviour is the same as super. |
void |
setRolloverEnabled(boolean rolloverEnabled)
Property to enable/disable rollover support. |
void |
setRowHeight(int rowHeight)
Overriden to keep view/model coordinates of SizeSequence in synch. |
void |
setRowHeight(int row,
int rowHeight)
Does nothing if support of individual rowHeights is not enabled. |
void |
setRowHeightEnabled(boolean enabled)
Sets enablement of individual rowHeight support. |
void |
setSearchable(Searchable searchable)
sets the Searchable for this editor. |
void |
setSelectionBackground(java.awt.Color selectionBackground)
Overridden because super throws NPE on null param. |
void |
setSelectionForeground(java.awt.Color selectionForeground)
Overridden because super throws NPE on null param. |
void |
setSelectionModel(javax.swing.ListSelectionModel newModel)
Overridden to update selectionMapper |
void |
setShowGrid(boolean showGrid)
Behaves exactly like super. |
void |
setShowGrid(boolean showHorizontalLines,
boolean showVerticalLines)
Convenience to set both grid line visibility and default margin for horizontal/vertical lines. |
void |
setSortable(boolean sortable)
Sets "sortable" property indicating whether or not this table supports sortable columns. |
void |
setSortOrder(int columnIndex,
SortOrder sortOrder)
Sorts the table by the given column using SortOrder. |
void |
setSortOrder(java.lang.Object identifier,
SortOrder sortOrder)
Sorts the table by the given column using the SortOrder. |
void |
setTerminateEditOnFocusLost(boolean terminate)
Sets the property to determine whether an ongoing edit should be terminated if the focus is moved to somewhere outside of the table. |
void |
setValueAt(java.lang.Object aValue,
int row,
int column)
Overridden to account for row index mapping. |
void |
setVisibleColumnCount(int visibleColumnCount)
Sets the preferred number of Columns to show in a JScrollPane. |
void |
setVisibleRowCount(int visibleRowCount)
Sets the preferred number of rows to show in a JScrollPane. |
void |
tableChanged(javax.swing.event.TableModelEvent e)
additionally updates filtered state. |
void |
toggleSortOrder(int columnIndex)
Toggles the sort order of the column at columnIndex. |
void |
toggleSortOrder(java.lang.Object identifier)
Toggles the sort order of the column with identifier. |
void |
transferFocus()
Overridden to try to stop the edit, if appropriate. |
void |
transferFocusBackward()
Overridden to try to stop the edit, if appropiate. |
void |
updateUI()
Additionally updates auto-adjusted row height and highlighters. |
| Methods inherited from class javax.swing.JTable |
|---|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnAtPoint, columnMoved, convertColumnIndexToModel, convertColumnIndexToView, createScrollPaneForTable, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRect, getCellSelectionEnabled, getColumn, getColumnClass, getColumnCount, getColumnModel, getColumnName, getColumnSelectionAllowed, getDefaultEditor, getDefaultRenderer, getDragEnabled, getDropLocation, getDropMode, getEditingColumn, getEditingRow, getEditorComponent, getGridColor, getIntercellSpacing, getModel, getPrintable, getRowHeight, getRowHeight, getRowMargin, getRowSelectionAllowed, getRowSorter, getScrollableBlockIncrement, getScrollableUnitIncrement, getSelectedColumn, getSelectedColumnCount, getSelectedColumns, getSelectedRow, getSelectedRowCount, getSelectedRows, getSelectionBackground, getSelectionForeground, getSelectionModel, getShowHorizontalLines, getShowVerticalLines, getSurrendersFocusOnKeystroke, getTableHeader, getToolTipText, getUI, getUIClassID, getUpdateSelectionOnSort, isCellSelected, isColumnSelected, isEditing, isRowSelected, moveColumn, print, print, print, print, print, removeColumn, removeColumnSelectionInterval, removeRowSelectionInterval, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setIntercellSpacing, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionMode, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, sizeColumnsToFit, sizeColumnsToFit, sorterChanged, 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, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, 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, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.swing.event.TableColumnModelListener |
|---|
columnAdded, columnMoved |
| Field Detail |
|---|
public static final java.lang.String FOCUS_PREVIOUS_COMPONENT
public static final java.lang.String FOCUS_NEXT_COMPONENT
public static final java.lang.String HORIZONTALSCROLL_ACTION_COMMAND
ActionMap.
public static final java.lang.String PACKALL_ACTION_COMMAND
ActionMap.
public static final java.lang.String PACKSELECTED_ACTION_COMMAND
ActionMap.
public static final java.lang.String UIPREFIX
ResourceBundle.
public static final java.lang.String MATCH_HIGHLIGHTER
public static final java.lang.String USE_DTCR_COLORMEMORY_HACK
resetDefaultTableCellRendererHighlighter,
Constant Field Values| Constructor Detail |
|---|
public JXTable()
public JXTable(javax.swing.table.TableModel dm)
dm - The model to use.
public JXTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm)
dm - The model to use.
public JXTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm,
javax.swing.ListSelectionModel sm)
dm - The table model to use.cm - The column model to use.sm - The list selection model to use.
public JXTable(int numRows,
int numColumns)
numRows - Count of rows to accommodate.numColumns - Count of columns to accommodate.
public JXTable(java.util.Vector rowData,
java.util.Vector columnNames)
rowData - Row data, as a Vector of Objects.columnNames - Column names, as a Vector of Strings.
public JXTable(java.lang.Object[][] rowData,
java.lang.Object[] columnNames)
rowData - Row data, as a two-dimensional Array of Objects (by row,
for column).columnNames - Column names, as a Array of Strings.| Method Detail |
|---|
public void setRolloverEnabled(boolean rolloverEnabled)
rolloverEnabled - public boolean isRolloverEnabled()
true if rollover is enabledpublic boolean isColumnControlVisible()
setColumnControlVisible(boolean),
setColumnControl(JComponent)public void setColumnControlVisible(boolean visible)
JXTable is contained in a JScrollPane, the
table adds the column control to the trailing corner of the scroll pane.
Note: if the table is not inside a JScrollPane the column
control is not shown even if this returns true. In this case it's the
responsibility of the client code to actually show it.
The default value is false.
visible - boolean to indicate if the column control should be shownisColumnControlVisible(),
setColumnControl(JComponent)public javax.swing.JComponent getColumnControl()
null.
setColumnControl(JComponent),
createDefaultColumnControl()public void setColumnControl(javax.swing.JComponent columnControl)
JScrollPane if appropriate. Passing a null
parameter restores the column control to the default.
The component is automatically visible only if the
columnControlVisible property is true and
the table is contained in a JScrollPane.
NOTE: from the table's perspective, the column control is simply a
JComponent to add to and keep in the trailing corner of
the scrollpane. (if any). It's up the concrete control to configure
itself from and keep synchronized to the columns' states.
columnControl - the JComponent to use as
columnControl.getColumnControl(),
createDefaultColumnControl(),
setColumnControlVisible(boolean)public void setComponentOrientation(java.awt.ComponentOrientation o)
Overridden to work around a core bug:
JScrollPane can't cope with
corners when changing component orientation at runtime.
This method explicitly re-configures the column control.
setComponentOrientation in class java.awt.Componento - the ComponentOrientation for this table.Component.setComponentOrientation(ComponentOrientation)public void setLocale(java.util.Locale locale)
Overridden to update locale-dependent properties.
setLocale in class java.awt.ComponentupdateLocaleState(Locale)public void packAll()
By default this method is bound to the pack all columns
Action and registered in the table's ActionMap.
public void packSelected()
By default this method is bound to the pack selected column
Action and registered in the table's ActionMap.
public void columnSelectionChanged(javax.swing.event.ListSelectionEvent e)
Overridden to update the enabled state of the pack selected column
Action.
columnSelectionChanged in interface javax.swing.event.TableColumnModelListenercolumnSelectionChanged in class javax.swing.JTablepublic void setHorizontalScrollEnabled(boolean enabled)
JViewport
horizontally and shows the horizontal scrollbar if necessary.
The default value is false.
Note: this is not a bound property, though it follows bean naming conventions. PENDING: Probably should be... If so, could be taken by a listening Action as in the app-framework.
PENDING JW: the name is mis-leading?
enabled - a boolean indicating whether enhanced auto-resize mode is
enabled.isHorizontalScrollEnabled()public boolean isHorizontalScrollEnabled()
setHorizontalScrollEnabled(boolean)public void setAutoResizeMode(int mode)
Overridden for internal bookkeeping related to the enhanced auto-resize behaviour.
Note: to enable/disable the enhanced auto-resize mode use exclusively
setHorizontalScrollEnabled, this method can't cope with it.
setAutoResizeMode in class javax.swing.JTablesetHorizontalScrollEnabled(boolean)public boolean getScrollableTracksViewportWidth()
Overridden to support enhanced auto-resize behaviour enabled and necessary.
getScrollableTracksViewportWidth in interface javax.swing.ScrollablegetScrollableTracksViewportWidth in class javax.swing.JTablesetHorizontalScrollEnabled(boolean)public void doLayout()
autoResizeMode property. Overridden to support enhanced auto-resize behaviour enabled and necessary.
doLayout in class javax.swing.JTablesetAutoResizeMode(int),
setHorizontalScrollEnabled(boolean)public void columnMarginChanged(javax.swing.event.ChangeEvent e)
Overridden to support enhanced auto-resize behaviour enabled and necessary.
columnMarginChanged in interface javax.swing.event.TableColumnModelListenercolumnMarginChanged in class javax.swing.JTablesetHorizontalScrollEnabled(boolean)public void setFillsViewportHeight(boolean fillsViewportHeight)
The default value is true.
Note: this a backport from Mustang's JTable.
setFillsViewportHeight in class javax.swing.JTablefillsViewportHeight - boolean to indicate whether the table should
always fill parent's height.getFillsViewportHeight(),
getScrollableTracksViewportHeight()public boolean getFillsViewportHeight()
getFillsViewportHeight in class javax.swing.JTablesetFillsViewportHeight(boolean),
getScrollableTracksViewportHeight()public boolean getScrollableTracksViewportHeight()
Overridden to control the tracksHeight property depending on fillsViewportHeight and relative size to containing parent.
getScrollableTracksViewportHeight in interface javax.swing.ScrollablegetScrollableTracksViewportHeight in class javax.swing.JTablesetFillsViewportHeight(boolean)public int getRowCount()
getRowCount in class javax.swing.JTablepublic int convertRowIndexToModel(int row)
convertRowIndexToModel in class javax.swing.JTablerow - row index in view coordinates
public int convertRowIndexToView(int row)
convertRowIndexToView in class javax.swing.JTablerow - row index in model coordinates
public java.lang.Object getValueAt(int row,
int column)
getValueAt in class javax.swing.JTable
public void setValueAt(java.lang.Object aValue,
int row,
int column)
!isCellEditable(row, column).
setValueAt in class javax.swing.JTableisCellEditable(int, int)
public boolean isCellEditable(int row,
int column)
row and column
is editable. Otherwise, invoking setValueAt on the cell
will have no effect.
Overridden to account for row index mapping and to support a layered editability control:
JXTable.isEditable()
TableColumnExt.isEditable()
TableModel.isCellEditable()
isCellEditable in class javax.swing.JTablerow - the row index in view coordinatescolumn - the column index in view coordinates
setValueAt(Object, int, int),
isEditable(),
TableColumnExt.isEditable(),
TableModel.isCellEditable(int, int)public void setSelectionModel(javax.swing.ListSelectionModel newModel)
setSelectionModel in class javax.swing.JTablepublic void setModel(javax.swing.table.TableModel newModel)
setModel in class javax.swing.JTablepublic boolean getAutoCreateColumnsFromModel()
Overridden for documentation clarification. The property has the same meaning as super, that is if true to re-create all table columns on either setting a new TableModel or receiving a structureChanged from the existing. The most obvious visual effect is that custom column properties appear to be "lost".
JXTable does support additonal custom configuration (via a custom ColumnFactory) which can (and incorrectly was) called independently from the creation. Setting this property to false guarantees that no column configuration is applied.
getAutoCreateColumnsFromModel in class javax.swing.JTabletableChanged(TableModelEvent),
ColumnFactorypublic void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged in interface javax.swing.event.TableModelListenertableChanged in class javax.swing.JTablepublic SelectionMapper getSelectionMapper()
SelectionMapperpublic FilterPipeline getFilters()
public void setFilters(FilterPipeline pipeline)
pipeline - the FilterPipeline to use, null removes
all filters.public void setSortable(boolean sortable)
sortable is
true then sorting will be enabled on all columns whose
sortable property is true. If
sortable is false then sorting will be
disabled for all columns, regardless of each column's individual
sorting property. The default is true.
sortable - boolean indicating whether or not this table supports sortable
columnsTableColumnExt.isSortable()public boolean isSortable()
public void resetSortOrder()
public void toggleSortOrder(int columnIndex)
The exact behaviour is defined by the SortController's toggleSortOrder implementation. Typically a unsorted column is sorted in ascending order, a sorted column's order is reversed.
Respects the tableColumnExt's sortable and comparator properties: routes the column's comparator to the SortController and does nothing if !isSortable(column).
PRE: 0 <= columnIndex < getColumnCount()
columnIndex - the columnIndex in view coordinates.
public void setSortOrder(int columnIndex,
SortOrder sortOrder)
PRE: 0 <= columnIndex < getColumnCount()
columnIndex - the column index in view coordinates.sortOrder - the sort order to use. If null or SortOrder.UNSORTED,
this method has the same effect as resetSortOrder();public SortOrder getSortOrder(int columnIndex)
columnIndex - the column index in view coordinates.
public void toggleSortOrder(java.lang.Object identifier)
The exact behaviour is defined by the SortController's toggleSortOrder implementation. Typically a unsorted column is sorted in ascending order, a sorted column's order is reversed.
Respects the tableColumnExt's sortable and comparator properties: routes the column's comparator to the SortController and does nothing if !isSortable(column).
PENDING: JW - define the behaviour if the identifier is not found. This can happen if either there's no column at all with the identifier or if there's no column of type TableColumnExt. Currently does nothing, that is does not change sort state.
identifier - the column identifier.
public void setSortOrder(java.lang.Object identifier,
SortOrder sortOrder)
PENDING: JW - define the behaviour if the identifier is not found. This can happen if either there's no column at all with the identifier or if there's no column of type TableColumnExt. Currently does nothing, that is does not change sort state.
identifier - the column's identifier.sortOrder - the sort order to use. If null or SortOrder.UNSORTED,
this method has the same effect as resetSortOrder();public SortOrder getSortOrder(java.lang.Object identifier)
identifier - the column's identifier.
public javax.swing.table.TableColumn getSortedColumn()
public void columnRemoved(javax.swing.event.TableColumnModelEvent e)
columnRemoved in interface javax.swing.event.TableColumnModelListenercolumnRemoved in class javax.swing.JTablepublic javax.swing.table.TableColumn getColumn(int viewColumnIndex)
TableColumn at view position
columnIndex. The return value is not null.
NOTE: This delegate method is added to protect developer's from
unexpected exceptions in jdk1.5+. Super does not expose the
TableColumn access by index which may lead to unexpected
IllegalArgumentException: If client code assumes the
delegate method is available, autoboxing will convert the given int to an
Integer which will call the getColumn(Object) method.
viewColumnIndex - index of the column with the object in question
TableColumn object that matches the column
index
java.lang.ArrayIndexOutOfBoundsException - if viewColumnIndex out of allowed
range.JTable.getColumn(Object),
getColumnExt(int),
TableColumnModel.getColumn(int)public java.util.List<javax.swing.table.TableColumn> getColumns()
List of visible TableColumns.
List of visible columns.getColumns(boolean)public int getColumnMargin()
Convenience to expose column model properties through
JXTable api.
setColumnMargin(int),
TableColumnModel.getColumnMargin()public void setColumnMargin(int value)
JXTable api.
value - margin between columns; must be greater than or equal to
zero.getColumnMargin(),
TableColumnModel.setColumnMargin(int)public int getColumnCount(boolean includeHidden)
includeHidden is true or
false, respectively. If false, this method returns the same count as
getColumnCount(). If the columnModel is not of type
TableColumnModelExt, the parameter value has no effect.
includeHidden - a boolean to indicate whether invisible columns
should be included
JTable.getColumnCount(),
TableColumnModelExt.getColumnCount(boolean)public java.util.List<javax.swing.table.TableColumn> getColumns(boolean includeHidden)
List of contained TableColumns.
Includes or excludes invisible columns, depending on whether the
includeHidden is true or false, respectively. If false, an
Iterator over the List is equivalent to the
Enumeration returned by getColumns().
If the columnModel is not of type
TableColumnModelExt, the parameter value has no effect.
NOTE: the order of columns in the List depends on whether or not the invisible columns are included, in the former case it's the insertion order in the latter it's the current order of the visible columns.
includeHidden - a boolean to indicate whether invisible columns
should be included
List of contained columns.getColumns(),
TableColumnModelExt.getColumns(boolean)public TableColumnExt getColumnExt(java.lang.Object identifier)
TableColumnExt with the given
identifier. The return value is null if there is no contained
column with identifier or if the column with identifier is not
of type TableColumnExt. The returned column
may be visible or hidden.
identifier - the object used as column identifier
TableColumnExt with the given identifier or
null if none is foundgetColumnExt(int),
JTable.getColumn(Object),
TableColumnModelExt.getColumnExt(Object)public TableColumnExt getColumnExt(int viewColumnIndex)
TableColumnExt at view position
columnIndex. The return value is null, if the column at
position columnIndex is not of type
TableColumnExt. The returned column is visible.
viewColumnIndex - the index of the column desired
TableColumnExt object that matches the column
index
java.lang.ArrayIndexOutOfBoundsException - if columnIndex out of allowed
range, that is if
(columnIndex < 0) || (columnIndex >= getColumnCount()).getColumnExt(Object),
getColumn(int),
TableColumnModelExt.getColumnExt(int)public void setColumnSequence(java.lang.Object[] identifiers)
identifiers - array of logical column namesgetColumns(boolean)public void columnPropertyChange(java.beans.PropertyChangeEvent event)
TableColumn.
Listens to column property changes.
columnPropertyChange in interface TableColumnModelExtListenerevent - a PropertyChangeEvent fired by a TableColumn
contained in a TableColumnModelpublic void createDefaultColumnsFromModel()
TableColumns for
columns in this table's TableModel. Removes all currently
contained TableColumns. The exact type and configuration
of the columns is controlled completely by the ColumnFactory.
Client code can use setColumnFactory(ColumnFactory) to plug-in a
custom ColumnFactory implementing their own default column creation and
behaviour.
Note: this method will probably become final (Issue #961-SwingX) so it's strongly recommended to not override now (and replace existing overrides by a custom ColumnFactory)!
createDefaultColumnsFromModel in class javax.swing.JTablesetColumnFactory(ColumnFactory),
ColumnFactorypublic ColumnFactory getColumnFactory()
setColumnFactory(ColumnFactory),
ColumnFactorypublic void setColumnFactory(ColumnFactory columnFactory)
ColumnFactory to use for column creation and
configuration. The default value is the shared application
ColumnFactory.Note: this method has no side-effect, that is existing columns are not re-created automatically, client code must trigger it manually.
columnFactory - the factory to use, null indicates
to use the shared application factory.getColumnFactory(),
ColumnFactorypublic void packTable(int margin)
margin - the margin to apply to each column.packColumn(int, int),
packColumn(int, int, int)
public void packColumn(int column,
int margin)
column - The Column index to pack in View Coordinatesmargin - The Margin to apply to the column width.packColumn(int, int, int),
packTable(int)
public void packColumn(int column,
int margin,
int max)
column - the column index to pack in view coordinatesmargin - the margin to apply to the columnmax - the maximum width the column can be resized to, -1 means no limitpackColumn(int, int),
packTable(int),
ColumnFactory.packColumn(JXTable, TableColumnExt, int, int)public int getVisibleRowCount()
JScrollPane.
JScrollPanesetVisibleRowCount(int)public void setVisibleRowCount(int visibleRowCount)
JScrollPane.
This is a bound property. The default value is 20.
PENDING: allow negative for use-all? Analogous to visColumnCount.
visibleRowCount - number of rows to show in a JScrollPane
java.lang.IllegalArgumentException - if given count is negative.getVisibleRowCount()public int getVisibleColumnCount()
JScrollPane.
setVisibleColumnCount(int)public void setVisibleColumnCount(int visibleColumnCount)
JScrollPane.
A negative number is interpreted as use-all available visible columns.
This is a bound property. The default value is -1 (effectively the same as before the introduction of this property).
visibleColumnCount - number of rows to show in a JScrollPanegetVisibleColumnCount()public void setPreferredScrollableViewportSize(java.awt.Dimension size)
If the given dimension is null, the auto-calculation of the pref scrollable size is enabled, otherwise the behaviour is the same as super. The default is auto-calc enabled on.
setPreferredScrollableViewportSize in class javax.swing.JTablegetPreferredScrollableViewportSize()public java.awt.Dimension getPreferredScrollableViewportSize()
Overridden to support auto-calculation of pref scrollable size, dependent on the visible row/column count properties. The auto-calc is on if there's no explicit pref scrollable size set. Otherwise the fixed size is returned
The calculation of the preferred scrollable width is delegated to the ColumnFactory to allow configuration with custom strategies implemented in custom factories.
getPreferredScrollableViewportSize in interface javax.swing.ScrollablegetPreferredScrollableViewportSize in class javax.swing.JTablesetPreferredScrollableViewportSize(Dimension),
ColumnFactory.getPreferredScrollableViewportWidth(JXTable)public void scrollRowToVisible(int row)
JViewport.
Note: this method has no precondition as it internally uses
getCellRect which is lenient to off-range coordinates.
row - the view row index of the cellscrollColumnToVisible(int),
scrollCellToVisible(int, int),
JComponent.scrollRectToVisible(Rectangle)public void scrollColumnToVisible(int column)
JViewport.
Note: this method has no precondition as it internally uses
getCellRect which is lenient to off-range coordinates.
column - the view column index of the cellscrollRowToVisible(int),
scrollCellToVisible(int, int),
JComponent.scrollRectToVisible(Rectangle)
public void scrollCellToVisible(int row,
int column)
JViewport.
Note: this method has no precondition as it internally uses
getCellRect which is lenient to off-range coordinates.
row - the view row index of the cellcolumn - the view column index of the cellscrollColumnToVisible(int),
scrollRowToVisible(int),
JComponent.scrollRectToVisible(Rectangle)public int getSelectionMode()
PENDING JW - setter?
ListSelectionModel.getSelectionMode()public Searchable getSearchable()
public void setSearchable(Searchable searchable)
searchable - public void setHighlighters(Highlighter... highlighters)
Highlighters to the table, replacing any old settings.
None of the given Highlighters must be null.This is a bound property.
Note: as of version #1.257 the null constraint is enforced strictly. To remove all highlighters use this method without param.
highlighters - zero or more not null highlighters to use for renderer decoration.
java.lang.NullPointerException - if array is null or array contains null values.getHighlighters(),
addHighlighter(Highlighter),
removeHighlighter(Highlighter)public Highlighter[] getHighlighters()
Highlighters used by this table.
Maybe empty, but guarantees to be never null.
setHighlighters(Highlighter[])public void addHighlighter(Highlighter highlighter)
Highlighter to the end of the list of used
Highlighters. The argument must not be null.
highlighter - the Highlighter to add, must not be null.
java.lang.NullPointerException - if Highlighter is null.removeHighlighter(Highlighter),
setHighlighters(Highlighter[])public void removeHighlighter(Highlighter highlighter)
Does nothing if the Highlighter is not contained.
highlighter - the Highlighter to remove.addHighlighter(Highlighter),
setHighlighters(Highlighter...)
public java.lang.String getStringAt(int row,
int column)
row - the row index of the cell in view coordinatescolumn - the column index of the cell in view coordinates.
public javax.swing.table.TableCellRenderer getCellRenderer(int row,
int column)
Overridden to fix core bug #4614616 (NPE if TableModel's
Class for the column is an interface). This method
guarantees to always return a not null value. Returns the
default renderer for Object if super returns
null.
getCellRenderer in class javax.swing.JTable
public java.awt.Component prepareRenderer(javax.swing.table.TableCellRenderer renderer,
int row,
int column)
Component used as a stamp to render
the specified cell. Overrides superclass version to provide support for
cell decorators.
Adjusts component orientation (guaranteed to happen before applying Highlighters).
Per-column highlighters contained in
TableColumnExt.getHighlighters() are applied to the renderer
after the table highlighters.
TODO kgs: interaction of search highlighter and column highlighters
Note: DefaultTableCellRenderer and subclasses require a hack to play
nicely with Highlighters because it has an internal "color memory" in
setForeground/setBackground. The hack is applied in
resetDefaultTableCellRendererColors which is called after
super.prepareRenderer and before applying the Highlighters. The method is
called always and for all renderers.
prepareRenderer in class javax.swing.JTablerenderer - the TableCellRenderer to preparerow - the row of the cell to render, where 0 is the first rowcolumn - the column of the cell to render, where 0 is the first
column
Component used as a stamp to render
the specified cellresetDefaultTableCellRendererColors(Component, int, int),
Highlighter
public java.awt.Component prepareEditor(javax.swing.table.TableCellEditor editor,
int row,
int column)
Overridden to adjust the editor's component orientation.
prepareEditor in class javax.swing.JTablepublic javax.swing.table.TableCellRenderer getNewDefaultRenderer(java.lang.Class<?> columnClass)
getDefaultRenderer() in that it returns
a new instance each time so that the renderer may be set and
customized on a particular column. NOTE: this doesn't work with swingx renderers! Do we really need it? It had been used in JNTable which is practically obsolete. If needed, we could make all renderer support classes clonable.
columnClass - Class of value being rendered
JTable.getDefaultRenderer(Class)public boolean isEditable()
JXTable as a whole.
setEditable(boolean)public void setEditable(boolean editable)
TableColumnExt.isEditable and their per-cell
editability as returned by the TableModel.isCellEditable.
If a cell is read-only in its column or model layer, this property has no
effect.
The default value is true.
editable - the flag to indicate if the table is editable.isEditable(),
isCellEditable(int, int)public boolean isTerminateEditOnFocusLost()
setTerminateEditOnFocusLost(boolean)public void setTerminateEditOnFocusLost(boolean terminate)
JTable.CellEditorRemover: "outside" is
interpreted to be on a component which is not under the table hierarchy
but inside the same toplevel window, "terminate" does so in any case,
first tries to stop the edit, if that's unsuccessful it cancels the edit.
The default value is true.
terminate - the flag to determine whether or not to terminate the
editisTerminateEditOnFocusLost()public boolean isAutoStartEditOnKeyStroke()
setAutoStartEditOnKeyStroke(boolean)public void setAutoStartEditOnKeyStroke(boolean autoStart)
The default value is true.
autoStart - boolean to determine whether a keyStroke should try to
start editing.isAutoStartEditOnKeyStroke()
public boolean editCellAt(int row,
int column,
java.util.EventObject e)
overridden to install a custom editor remover.
editCellAt in class javax.swing.JTablepublic void removeEditor()
removeEditor in class javax.swing.JTablepublic void removeNotify()
Overridden to uninstall the custom editor remover.
removeNotify in class javax.swing.JTablepublic boolean isFocusCycleRoot()
Overridden to prevent spurious focus loss to outside of table while removing the editor. This is essentially a hack around core bug #6210779. PENDING: add link to wiki!
isFocusCycleRoot in class java.awt.Containerpublic void transferFocus()
Overridden to try to stop the edit, if appropriate. Calls super if succeeded, does not yield otherwise.
transferFocus in class java.awt.Componentpublic void transferFocusBackward()
Overridden to try to stop the edit, if appropiate. Calls super if succeeded, does not yield otherwise.
transferFocusBackward in class java.awt.Containerpublic void updateUI()
Additionally updates auto-adjusted row height and highlighters.
Another of the override motivation is to fix core issue (?? ID): super fails to update all renderers/editors.
updateUI in class javax.swing.JTable
public void setShowGrid(boolean showHorizontalLines,
boolean showVerticalLines)
showHorizontalLines - boolean to decide whether to draw horizontal
grid lines.showVerticalLines - boolean to decide whether to draw vertical grid
lines.JTable.setShowGrid(boolean),
JTable.setIntercellSpacing(Dimension)public void setShowGrid(boolean showGrid)
Behaves exactly like super.
It's overridden to warn against a frequent programming error: this method toggles only the visibility of the grid lines, it does not update the row/column margins - which may lead to visual artefacts, as f.i. not showing the lines at all or showing normal table background in selected state where the lines should have been.
setShowGrid in class javax.swing.JTablesetShowGrid(boolean, boolean)public void setRowHeight(int rowHeight)
Overriden to keep view/model coordinates of SizeSequence in synch. Marks the request as client-code induced.
setRowHeight in class javax.swing.JTableisXTableRowHeightSet
public void setRowHeight(int row,
int rowHeight)
Does nothing if support of individual rowHeights is not enabled. Overriden to keep view/model coordinates of SizeSequence in synch.
setRowHeight in class javax.swing.JTableisRowHeightEnabled()public void setRowHeightEnabled(boolean enabled)
The default value is false.
enabled - a boolean to indicate whether per-row heights should be
enabled.isRowHeightEnabled(),
setRowHeight(int, int)public boolean isRowHeightEnabled()
setRowHeightEnabled(boolean),
setRowHeight(int, int)public int rowAtPoint(java.awt.Point point)
Overridden to work around core Bug (ID #6291631): negative y is mapped to row 0).
rowAtPoint in class javax.swing.JTablepublic void setSelectionBackground(java.awt.Color selectionBackground)
Overridden because super throws NPE on null param.
setSelectionBackground in class javax.swing.JTablepublic void setSelectionForeground(java.awt.Color selectionForeground)
Overridden because super throws NPE on null param.
setSelectionForeground in class javax.swing.JTablepublic void setGridColor(java.awt.Color gridColor)
Overridden because super throws NPE on null param.
setGridColor in class javax.swing.JTable
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||