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.
public function installUI(c:Component):Void
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:
LayoutManager
on the component if necessary.
c | the component where this UI delegate is being installed |
public function uninstallUI(c:Component):Void
Reverses configuration which was done on the specified component during
installUI
. This method is invoked when this
ComponentUI
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 Component
instance in a clean state (no
extraneous listeners, look-and-feel-specific property objects, etc.).
This should include the following:
c | the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
public function create(c:Component):Void
Notifies this UI delegate that it's time to create the specified
component's ui MCs. This method is invoked by Component
when the specified component is being created.
In general this method need not be overridden by subclasses; all look-and-feel ui creating code should reside in this method.
c | the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
public function paint(c:Component, g:Graphics, b:Rectangle):Void
Notifies this UI delegate that it's time to paint the specified
component. This method is invoked by Component
when the specified component is being painted.
In general this method need be overridden by subclasses; all look-and-feel rendering code should reside in this method. And there is a default background paint method, you should call it in your overridden paint method.
c | the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components. |
g | the Graphics context in which to paint. |
b | the bounds to paint UI in. |
static public function fillRectBackGround(c:Component, g:Graphics, b:Rectangle):Void
Utils method to paint the background of the component with the background color in the component rect.
c | the component whose background being painted. |
g | the Graphics context in which to paint. |
b | the bounds to paint background in. |
public function getPreferredSize(c:Component):Dimension
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
.
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 |
public function getMinimumSize(c:Component):Dimension
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.
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 |
a Dimension
object or null
public function getMaximumSize(c:Component):Dimension
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.
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 |
a Dimension
object or null