java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.TableUI
javax.swing.plaf.basic.BasicTableUI
- Direct Known Subclasses:
SynthTableUI
BasicTableUI implementation
-
Nested Class Summary
Modifier and TypeClassDescriptionclass
This class should be treated as a "protected" inner class.class
This class should be treated as a "protected" inner class.class
This class should be treated as a "protected" inner class. -
Field Summary
Modifier and TypeFieldDescriptionprotected FocusListener
FocusListener
that are attached to theJTable
.protected KeyListener
KeyListener
that are attached to theJTable
.protected MouseInputListener
MouseInputListener
that are attached to theJTable
.protected CellRendererPane
The instance ofCellRendererPane
.protected JTable
The instance ofJTable
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected FocusListener
Creates the focus listener for handling keyboard navigation in theJTable
.protected KeyListener
Creates the key listener for handling keyboard navigation in theJTable
.protected MouseInputListener
Creates the mouse listener for theJTable
.static ComponentUI
Returns a new instance ofBasicTableUI
.int
getBaseline
(JComponent c, int width, int height) Returns the baseline.Returns an enum indicating how the baseline of the component changes as the size changes.Return the maximum size of the table.Return the minimum size of the table.Return the preferred size of the table.protected void
Initialize JTable properties, e.g. font, foreground, and background.protected void
Register all keyboard actions on the JTable.protected void
Attaches listeners to the JTable.void
paint
(Graphics g, JComponent c) Paint a representation of thetable
instance that was set in installUI().protected void
Uninstalls default properties.protected void
Unregisters keyboard actions.protected void
Unregisters listeners.Methods declared in class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, installUI, uninstallUI, update
-
Field Details
-
table
The instance ofJTable
. -
rendererPane
The instance ofCellRendererPane
. -
keyListener
KeyListener
that are attached to theJTable
. -
focusListener
FocusListener
that are attached to theJTable
. -
mouseInputListener
MouseInputListener
that are attached to theJTable
.
-
-
Constructor Details
-
BasicTableUI
public BasicTableUI()Constructs aBasicTableUI
.
-
-
Method Details
-
createKeyListener
Creates the key listener for handling keyboard navigation in theJTable
.- Returns:
- the key listener for handling keyboard navigation in the
JTable
-
createFocusListener
Creates the focus listener for handling keyboard navigation in theJTable
.- Returns:
- the focus listener for handling keyboard navigation in the
JTable
-
createMouseInputListener
Creates the mouse listener for theJTable
.- Returns:
- the mouse listener for the
JTable
-
createUI
Returns a new instance ofBasicTableUI
.- Parameters:
c
- a component- Returns:
- a new instance of
BasicTableUI
-
installDefaults
protected void installDefaults()Initialize JTable properties, e.g. font, foreground, and background. The font, foreground, and background properties are only set if their current value is either null or a UIResource, other properties are set if the current value is null.- See Also:
-
installListeners
protected void installListeners()Attaches listeners to the JTable. -
installKeyboardActions
protected void installKeyboardActions()Register all keyboard actions on the JTable. -
uninstallDefaults
protected void uninstallDefaults()Uninstalls default properties. -
uninstallListeners
protected void uninstallListeners()Unregisters listeners. -
uninstallKeyboardActions
protected void uninstallKeyboardActions()Unregisters keyboard actions. -
getBaseline
Returns the baseline.- Overrides:
getBaseline
in classComponentUI
- Parameters:
c
-JComponent
baseline is being requested forwidth
- the width to get the baseline forheight
- the height to get the baseline for- Returns:
- baseline or a value < 0 indicating there is no reasonable baseline
- Throws:
NullPointerException
- ifc
isnull
IllegalArgumentException
- if width or height is < 0- Since:
- 1.6
- See Also:
-
getBaselineResizeBehavior
Returns an enum indicating how the baseline of the component changes as the size changes.- Overrides:
getBaselineResizeBehavior
in classComponentUI
- Parameters:
c
-JComponent
to return baseline resize behavior for- Returns:
- an enum indicating how the baseline changes as the component size changes
- Throws:
NullPointerException
- ifc
isnull
- Since:
- 1.6
- See Also:
-
getMinimumSize
Return the minimum size of the table. The minimum height is the row height times the number of rows. The minimum width is the sum of the minimum widths of each column.- Overrides:
getMinimumSize
in classComponentUI
- Parameters:
c
- the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- Returns:
- a
Dimension
object ornull
- See Also:
-
getPreferredSize
Return the preferred size of the table. The preferred height is the row height times the number of rows. The preferred width is the sum of the preferred widths of each column.- Overrides:
getPreferredSize
in classComponentUI
- Parameters:
c
- the component whose preferred size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- Returns:
- a
Dimension
object containing given component's preferred size appropriate for the look and feel - See Also:
-
getMaximumSize
Return the maximum size of the table. The maximum height is the row heighttimes the number of rows. The maximum width is the sum of the maximum widths of each column.- Overrides:
getMaximumSize
in classComponentUI
- Parameters:
c
- the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- Returns:
- a
Dimension
object ornull
- See Also:
-
paint
Paint a representation of thetable
instance that was set in installUI().- Overrides:
paint
in classComponentUI
- Parameters:
g
- theGraphics
context in which to paintc
- the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components- See Also:
-