Methods Summary |
---|
public boolean | contains(javax.swing.JComponent c, int x, int y)Returns true if the specified x,y location is
contained within the look and feel's defined shape of the specified
component. x and y are defined to be relative
to the coordinate system of the specified component. Although
a component's bounds is constrained to a rectangle,
this method provides the means for defining a non-rectangular
shape within those bounds for the purpose of hit detection.
return c.inside(x, y);
|
public static javax.swing.plaf.ComponentUI | createUI(javax.swing.JComponent c)Returns an instance of the UI delegate for the specified component.
Each subclass must provide its own static createUI
method that returns an instance of that UI delegate subclass.
If the UI delegate subclass is stateless, it may return an instance
that is shared by multiple components. If the UI delegate is
stateful, then it should return a new instance per component.
The default implementation of this method throws an error, as it
should never be invoked.
throw new Error("ComponentUI.createUI not implemented.");
|
public javax.accessibility.Accessible | getAccessibleChild(javax.swing.JComponent c, int i)Returns the i th Accessible child of the object.
UIs might need to override this if they present areas on the
screen that can be viewed as components, but actual components
are not used for presenting those areas.
Note: As of v1.3, it is recommended that developers call
Component.AccessibleAWTComponent.getAccessibleChild() instead of
this method.
return SwingUtilities.getAccessibleChild(c, i);
|
public int | getAccessibleChildrenCount(javax.swing.JComponent c)Returns the number of accessible children in the object. If all
of the children of this object implement Accessible ,
this
method should return the number of children of this object.
UIs might wish to override this if they present areas on the
screen that can be viewed as components, but actual components
are not used for presenting those areas.
Note: As of v1.3, it is recommended that developers call
Component.AccessibleAWTComponent.getAccessibleChildrenCount() instead
of this method.
return SwingUtilities.getAccessibleChildrenCount(c);
|
public java.awt.Dimension | getMaximumSize(javax.swing.JComponent c)Returns the specified component's maximum size appropriate for
the look and feel. If null is returned, the maximum
size will be calculated by the component's layout manager instead
(this is the preferred approach for any component with a specific
layout manager installed). The default implementation of this
method invokes getPreferredSize and returns that value.
return getPreferredSize(c);
|
public java.awt.Dimension | getMinimumSize(javax.swing.JComponent c)Returns the specified component's minimum size appropriate for
the look and feel. If null is returned, the minimum
size will be calculated by the component's layout manager instead
(this is the preferred approach for any component with a specific
layout manager installed). The default implementation of this
method invokes getPreferredSize and returns that value.
return getPreferredSize(c);
|
public java.awt.Dimension | getPreferredSize(javax.swing.JComponent c)Returns the specified component's preferred size appropriate for
the look and feel. If null is returned, the preferred
size will be calculated by the component's layout manager instead
(this is the preferred approach for any component with a specific
layout manager installed). The default implementation of this
method returns null .
return null;
|
public void | installUI(javax.swing.JComponent c)Configures the specified component appropriate for the look and feel.
This method is invoked when the ComponentUI 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 any 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.
|
public void | paint(java.awt.Graphics g, javax.swing.JComponent c)Paints the specified component appropriate for the look and feel.
This method is invoked from the ComponentUI.update method when
the specified component is being painted. Subclasses should override
this method and use the specified Graphics object to
render the content of the component.
|
public void | uninstallUI(javax.swing.JComponent c)Reverses configuration which was done on the specified component during
installUI . This method is invoked when this
UIComponent instance is being removed as the UI delegate
for the specified component. This method should undo the
configuration performed in installUI , being careful to
leave the JComponent instance in a clean state (no
extraneous listeners, look-and-feel-specific property objects, etc.).
This should include the following:
- Remove any UI-set borders from the component.
- Remove any UI-set layout managers on the component.
- Remove any UI-added sub-components from the component.
- Remove any UI-added event/property listeners from the component.
- Remove any UI-installed keyboard UI from the component.
- Nullify any allocated instance data objects to allow for GC.
|
public void | update(java.awt.Graphics g, javax.swing.JComponent c)Notifies this UI delegate that it's time to paint the specified
component. This method is invoked by JComponent
when the specified component is being painted.
By default this method will fill the specified component with
its background color (if its opaque property is
true ) and then immediately call paint .
In general this method need not be overridden by subclasses;
all look-and-feel rendering code should reside in the paint
method.
if (c.isOpaque()) {
g.setColor(c.getBackground());
g.fillRect(0, 0, c.getWidth(),c.getHeight());
}
paint(g, c);
|