Class ComponentUI
java.lang.Object
javax.swing.plaf.ComponentUI
- Direct Known Subclasses:
ButtonUI
,ColorChooserUI
,ComboBoxUI
,DesktopIconUI
,DesktopPaneUI
,FileChooserUI
,InternalFrameUI
,LabelUI
,LayerUI
,ListUI
,MenuBarUI
,OptionPaneUI
,PanelUI
,PopupMenuUI
,ProgressBarUI
,RootPaneUI
,ScrollBarUI
,ScrollPaneUI
,SeparatorUI
,SliderUI
,SpinnerUI
,SplitPaneUI
,TabbedPaneUI
,TableHeaderUI
,TableUI
,TextUI
,ToolBarUI
,ToolTipUI
,TreeUI
,ViewportUI
The base class for all UI delegate objects in the Swing pluggable
look and feel architecture. The UI delegate object for a Swing
component is responsible for implementing the aspects of the
component that depend on the look and feel.
The
JComponent
class
invokes methods from this class in order to delegate operations
(painting, layout calculations, etc.) that may vary depending on the
look and feel installed. Client programs should not invoke methods
on this class directly.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
contains
(JComponent c, int x, int y) Returnstrue
if the specified x,y location is contained within the look and feel's defined shape of the specified component.static ComponentUI
Returns an instance of the UI delegate for the specified component.getAccessibleChild
(JComponent c, int i) Returns thei
thAccessible
child of the object.int
Returns the number of accessible children in the object.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.Returns the specified component's maximum size appropriate for the look and feel.Returns the specified component's minimum size appropriate for the look and feel.Returns the specified component's preferred size appropriate for the look and feel.void
Configures the specified component appropriately for the look and feel.void
paint
(Graphics g, JComponent c) Paints the specified component appropriately for the look and feel.void
Reverses configuration which was done on the specified component duringinstallUI
.void
update
(Graphics g, JComponent c) Notifies this UI delegate that it is time to paint the specified component.
-
Constructor Details
-
ComponentUI
public ComponentUI()Sole constructor. (For invocation by subclass constructors, typically implicit.)
-
-
Method Details
-
installUI
Configures the specified component appropriately for the look and feel. This method is invoked when theComponentUI
instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:- Install default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
- Install a
LayoutManager
on the component if necessary. - Create/add any required sub-components to the component.
- Create/install event listeners on the component.
- Create/install a
PropertyChangeListener
on the component in order to detect and respond to component property changes appropriately. - Install keyboard UI (mnemonics, traversal, etc.) on the component.
- Initialize any appropriate instance data.
- Parameters:
c
- the component where this UI delegate is being installed- See Also:
-