|
||||||||||
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 com.jstatcom.table.BorderTable
public class BorderTable
A subclass of JTables
that respects the border set.
JTables
do not respect borders at all.
Beside respecting borders this table can also deal with dynamic column width,
e.g. it is possible to configure a BorderTable
object such
that it automatically adjustes the column width when the data displayed
changes. These adjustments can be limited to a minimum and maximum width.
This table draws grid lines before the first row and the first column. For that it needs 1 pixel each direction.
Nested Class Summary |
---|
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 |
---|
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 | |
---|---|
BorderTable()
Constructs an empty BorderTable . |
|
BorderTable(javax.swing.table.TableModel dm,
javax.swing.table.TableColumnModel cm,
javax.swing.ListSelectionModel sm)
Constructs a BorderTable with some default settings and
initializes the border. |
Method Summary | |
---|---|
int |
columnAtPoint(java.awt.Point point)
Reimplements super method such that it considers the border now. |
void |
createDefaultColumnsFromModel()
Reimplements super method. |
java.awt.Rectangle |
getCellRect(int row,
int column,
boolean includeSpacing)
Reimplements super method such that it considers the border now. |
int |
getColumnWidth()
Returns current column width. |
int |
getMaximumColumnWidth()
Returns maximum column width property. |
java.awt.Dimension |
getMaximumSize()
Returns the value of a getPreferredSize() method call. |
int |
getMinimumColumnWidth()
Returns minimum column width property. |
java.awt.Dimension |
getMinimumSize()
Returns the value of a getPreferredSize() method call. |
java.awt.Dimension |
getPreferredSize()
Reimplements super method such that it considers the border now. |
boolean |
isDynamicColumnWidth()
Return true if the BorderTable 's column width (and the
BorderTable 's width) depends on the data displayed. |
int |
maxCellLength()
Computes the maximum length of all cells. |
int |
rowAtPoint(java.awt.Point point)
Reimplements super method such that it considers the border now. |
void |
setBorder(javax.swing.border.Border border)
Reimplements super method such that the borderTableBorder
is always set as the most inner border. |
void |
setColumnWidth(int newValue)
This method sets the column width of the BorderTable to
newValue . |
void |
setDynamicColumnWidth(boolean newDynamicColumnWidth)
Set whether the BorderTable 's column width adjust when
the data displayed. change. |
void |
setIntercellSpacing(java.awt.Dimension newSpacing)
Sets the width and height between cells to newSpacing and
redisplays the receiver. |
void |
setMaximumColumnWidth(int newMaximumColumnWidth)
Sets the BorderTable 's maximum column width. |
void |
setMinimumColumnWidth(int newMinimumColumnWidth)
Sets the BorderTable 's minimum column width. |
void |
sizeColumnsToFit(int c)
Empty method. |
void |
tableChanged(javax.swing.event.TableModelEvent e)
Calls super method and determines and sets new maximum column width if isDynamicColumnWidth returns true . |
Methods inherited from class javax.swing.JTable |
---|
addColumn, addColumnSelectionInterval, addNotify, addRowSelectionInterval, changeSelection, clearSelection, columnAdded, columnMarginChanged, columnMoved, columnRemoved, columnSelectionChanged, convertColumnIndexToModel, convertColumnIndexToView, convertRowIndexToModel, convertRowIndexToView, createScrollPaneForTable, doLayout, editCellAt, editCellAt, editingCanceled, editingStopped, getAccessibleContext, getAutoCreateColumnsFromModel, getAutoCreateRowSorter, getAutoResizeMode, getCellEditor, getCellEditor, getCellRenderer, 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, selectAll, setAutoCreateColumnsFromModel, setAutoCreateRowSorter, setAutoResizeMode, setCellEditor, setCellSelectionEnabled, setColumnModel, setColumnSelectionAllowed, setColumnSelectionInterval, setDefaultEditor, setDefaultRenderer, setDragEnabled, setDropMode, setEditingColumn, setEditingRow, setFillsViewportHeight, setGridColor, setModel, setPreferredScrollableViewportSize, setRowHeight, setRowHeight, setRowMargin, setRowSelectionAllowed, setRowSelectionInterval, setRowSorter, setSelectionBackground, setSelectionForeground, setSelectionMode, setSelectionModel, setShowGrid, setShowHorizontalLines, setShowVerticalLines, setSurrendersFocusOnKeystroke, setTableHeader, setUI, setUpdateSelectionOnSort, setValueAt, sizeColumnsToFit, sorterChanged, 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, getNextFocusableComponent, getPopupLocation, 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, 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 |
Constructor Detail |
---|
public BorderTable()
BorderTable
.
public BorderTable(javax.swing.table.TableModel dm, javax.swing.table.TableColumnModel cm, javax.swing.ListSelectionModel sm)
BorderTable
with some default settings and
initializes the border.
dm
- the table modelcm
- the column modelsm
- the list selection modelMethod Detail |
---|
public int columnAtPoint(java.awt.Point point)
columnAtPoint
in class javax.swing.JTable
point
- the point to be checked for the underlying column
public void createDefaultColumnsFromModel()
createDefaultColumnsFromModel
in class javax.swing.JTable
public java.awt.Rectangle getCellRect(int row, int column, boolean includeSpacing)
getCellRect
in class javax.swing.JTable
public int getColumnWidth()
public int getMaximumColumnWidth()
public java.awt.Dimension getMaximumSize()
getPreferredSize()
method call.
getMaximumSize
in class javax.swing.JComponent
public int getMinimumColumnWidth()
public java.awt.Dimension getMinimumSize()
getPreferredSize()
method call.
getMinimumSize
in class javax.swing.JComponent
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public boolean isDynamicColumnWidth()
BorderTable
's column width (and the
BorderTable
's width) depends on the data displayed.
true
if dynamic adjustment is onpublic int maxCellLength()
public int rowAtPoint(java.awt.Point point)
rowAtPoint
in class javax.swing.JTable
point
- the point to be checked for the underlying row
public void setBorder(javax.swing.border.Border border)
borderTableBorder
is always set as the most inner border.
setBorder
in class javax.swing.JComponent
public void setColumnWidth(int newValue)
BorderTable
to
newValue
. If newValue
exceeds the minimum
or maximum width, it's adjusted to the appropriate limiting value. Posts
a vetoable property change notification with the name
"columnWidth"
.
newValue
- the new column width
java.lang.IllegalArgumentException
- newValue < 0
public void setDynamicColumnWidth(boolean newDynamicColumnWidth)
BorderTable
's column width adjust when
the data displayed. change. The adjustment takes place within the minimum
and maximum width.
newDynamicColumnWidth
- booleanpublic void setIntercellSpacing(java.awt.Dimension newSpacing)
newSpacing
and
redisplays the receiver. Posts a vetoable property change notification
with the name "intercellSpacing".
setIntercellSpacing
in class javax.swing.JTable
newSpacing
- the new width and height intercellSpacingJTable.getIntercellSpacing()
public void setMaximumColumnWidth(int newMaximumColumnWidth)
BorderTable
's maximum column width.
newMaximumColumnWidth
- the new maximum widthpublic void setMinimumColumnWidth(int newMinimumColumnWidth)
BorderTable
's minimum column width.
newMinimumColumnWidth
- the new minimum widthpublic final void sizeColumnsToFit(int c)
BorderTables
is determinied
by the column width there is no need to fit the columns to set bounds.
sizeColumnsToFit
in class javax.swing.JTable
public void tableChanged(javax.swing.event.TableModelEvent e)
isDynamicColumnWidth
returns true
.
tableChanged
in interface javax.swing.event.TableModelListener
tableChanged
in class javax.swing.JTable
e
- the event
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |