org.apache.pivot.wtk
Class Component

java.lang.Object
  extended by org.apache.pivot.wtk.Component
All Implemented Interfaces:
ConstrainedVisual, Visual
Direct Known Subclasses:
ActivityIndicator, Button, ChartView, Container, GridPane.Filler, ImageView, Label, ListView, Meter, MovieView, ScrollPane.Corner, Separator, TablePane.Filler, TableView, TableViewHeader, TerraRollupSkin.RollupButton, TerraScrollBarSkin.Handle, TerraScrollBarSkin.ScrollButton, TerraSliderSkin.Thumb, TerraSpinnerSkin.SpinButton, TerraSpinnerSkin.SpinnerContent, TerraSplitPaneSkin.Splitter, TerraSplitPaneSkin.SplitterShadow, TextArea, TextInput, TreeView

public abstract class Component
extends Object
implements ConstrainedVisual

Top level abstract base class for all components. In MVC terminology, a component represents the "controller". It has no inherent visual representation and acts as an intermediary between the component's data (the "model") and the skin, an implementation of Skin which serves as the "view".

TODO Add a contains() method or some equivalent that will support mouse interaction with non-rectangular components.


Nested Class Summary
 class Component.DecoratorSequence
          Decorator sequence implementation.
 class Component.StyleDictionary
          Style dictionary implementation.
 class Component.UserDataDictionary
          User data dictionary implementation.
 
Constructor Summary
Component()
           
 
Method Summary
 void clear()
          Clears any bound values in the component.
static void clearFocus()
          Clears the focus.
protected  Object getAttributes()
          Returns the component's attributes.
 String getAutomationID()
          Returns the component's automation ID.
 int getBaseline()
          Returns the component's baseline.
 int getBaseline(int width, int height)
          Returns the component's baseline for a given width and height.
 Bounds getBounds()
          Returns the component's bounding area.
static ListenerList<ComponentClassListener> getComponentClassListeners()
           
 ListenerList<ComponentDataListener> getComponentDataListeners()
           
 ListenerList<ComponentDecoratorListener> getComponentDecoratorListeners()
           
 ListenerList<ComponentKeyListener> getComponentKeyListeners()
           
 ListenerList<ComponentListener> getComponentListeners()
           
 ListenerList<ComponentMouseButtonListener> getComponentMouseButtonListeners()
           
 ListenerList<ComponentMouseListener> getComponentMouseListeners()
           
 ListenerList<ComponentMouseWheelListener> getComponentMouseWheelListeners()
           
 ListenerList<ComponentStateListener> getComponentStateListeners()
           
 Cursor getCursor()
          Returns the cursor that is displayed when the mouse pointer is over this component.
 Bounds getDecoratedBounds()
          Returns the component's bounding area including decorators.
 Component.DecoratorSequence getDecorators()
          Returns the component's decorator sequence.
 Display getDisplay()
           
 DragSource getDragSource()
           
 DropTarget getDropTarget()
           
static Component getFocusedComponent()
          Returns the currently focused component.
 Graphics2D getGraphics()
          Creates a graphics context for this component.
 int getHeight()
          Returns the visual's height.
 Point getLocation()
          Returns the component's location.
 int getMaximumPreferredHeight()
          Gets the maximum preferred height of this component.
 int getMaximumPreferredWidth()
          Gets the maximum preferred width of this component.
 MenuHandler getMenuHandler()
           
 int getMinimumPreferredHeight()
          Gets the minimum preferred height of this component.
 int getMinimumPreferredWidth()
          Gets the minimum preferred width of this component.
 Container getParent()
           
 int getPreferredHeight()
          Returns the component's unconstrained preferred height.
 int getPreferredHeight(int width)
          Returns the component's constrained preferred height.
 Limits getPreferredHeightLimits()
          Gets the preferred height limits for this component.
 Dimensions getPreferredSize()
          Gets the component's unconstrained preferred size.
 int getPreferredWidth()
          Returns the component's unconstrained preferred width.
 int getPreferredWidth(int height)
          Returns the component's constrained preferred width.
 Limits getPreferredWidthLimits()
          Gets the preferred width limits for this component.
 Dimensions getSize()
           
protected  Skin getSkin()
          Returns the currently installed skin.
 Component.StyleDictionary getStyles()
          Returns a dictionary instance representing the component's style properties.
 String getTooltipText()
          Returns the component's tooltip text.
 Component.UserDataDictionary getUserData()
          Returns the user data dictionary.
 Bounds getVisibleArea()
          Determines the visible area of a component.
 Bounds getVisibleArea(Bounds area)
          Determines the visible area of a component.
 Bounds getVisibleArea(int x, int y, int width, int height)
          Determines the visible area of a component.
 int getWidth()
          Returns the visual's width.
 Window getWindow()
           
 int getX()
          Returns the component's x-coordinate.
 int getY()
          Returns the component's y-coordinate.
protected  void installThemeSkin(Class<? extends Component> componentClass)
          Installs the skin for the given component class, as defined by the current theme.
 void invalidate()
          Flags the component's hierarchy as invalid, and clears any cached preferred size.
 boolean isBlocked()
          Determines if this component is blocked.
 boolean isEnabled()
          Returns the component's enabled state.
 boolean isFocusable()
          Returns this component's focusability.
 boolean isFocused()
          Returns the component's focused state.
 boolean isMouseOver()
          Determines if the mouse is positioned over this component.
 boolean isOpaque()
          Tells whether or not this component is fully opaque when painted.
 boolean isPreferredHeightSet()
          Returns a flag indicating whether the preferred height was explicitly set by the caller or is the default value determined by the skin.
 boolean isPreferredSizeSet()
          Returns a flag indicating whether the preferred size was explicitly set by the caller or is the default value determined by the skin.
 boolean isPreferredWidthSet()
          Returns a flag indicating whether the preferred width was explicitly set by the caller or is the default value determined by the skin.
 boolean isShowing()
          Determines if this component is showing.
 boolean isValid()
          Returns the component's valid state.
 boolean isVisible()
          Returns the component's visibility.
protected  boolean keyPressed(int keyCode, Keyboard.KeyLocation keyLocation)
           
protected  boolean keyReleased(int keyCode, Keyboard.KeyLocation keyLocation)
           
protected  boolean keyTyped(char character)
           
protected  void layout()
          Called to lay out the component.
 void load(Dictionary<String,?> context)
          Copies bound values from the bind context to the component.
 void load(Object context)
          Copies bound values from the bind context to the component by converting the given context to a bean dictionary.
 Point mapPointFromAncestor(Container ancestor, int x, int y)
          Maps a point in the specified ancestor's coordinate space to this component's coordinate system.
 Point mapPointToAncestor(Container ancestor, int x, int y)
          Maps a point in this component's coordinate system to the specified ancestor's coordinate space.
protected  boolean mouseClick(Mouse.Button button, int x, int y, int count)
           
protected  boolean mouseDown(Mouse.Button button, int x, int y)
           
protected  boolean mouseMove(int x, int y)
           
protected  void mouseOut()
           
protected  void mouseOver()
           
protected  boolean mouseUp(Mouse.Button button, int x, int y)
           
protected  boolean mouseWheel(Mouse.ScrollType scrollType, int scrollAmount, int wheelRotation, int x, int y)
           
 void paint(Graphics2D graphics)
          Paints the component.
 void reenterMouse()
          If the mouse is currently over the component, causes the component to fire mouseOut() and a mouseMove() at the current mouse location.
 void repaint()
          Flags the entire component as needing to be repainted.
 void repaint(boolean immediate)
          Flags the entire component as needing to be repainted.
 void repaint(Bounds area)
          Flags an area as needing to be repainted.
 void repaint(Bounds area, boolean immediate)
          Flags an area as needing to be repainted or repaints the rectangle immediately.
 void repaint(int x, int y, int width, int height)
          Flags an area as needing to be repainted.
 void repaint(int x, int y, int width, int height, boolean immediate)
          Flags an area as needing to be repainted.
 boolean requestFocus()
          Requests that focus be given to this component.
 void scrollAreaToVisible(Bounds area)
          Ensures that the given area of a component is visible within the viewports of all applicable ancestors.
 void scrollAreaToVisible(int x, int y, int width, int height)
          Ensures that the given area of a component is visible within the viewports of all applicable ancestors.
protected  void setAttributes(Object attributes)
          Sets the component's attributes.
 void setAutomationID(String automationID)
          Sets the component's automation ID.
 void setCursor(Cursor cursor)
          Sets the cursor that is displayed when the mouse pointer is over this component.
 void setCursor(String cursor)
           
 void setDragSource(DragSource dragSource)
           
 void setDropTarget(DropTarget dropTarget)
           
 void setEnabled(boolean enabled)
          Sets the component's enabled state.
 void setHeight(int height)
           
 void setLocation(int x, int y)
          Sets the component's location.
 void setLocation(Point location)
          Sets the component's location.
 void setMaximumPreferredHeight(int maximumPreferredHeight)
          Sets the maximum preferred height of this component.
 void setMaximumPreferredWidth(int maximumPreferredWidth)
          Sets the maximum preferred width of this component.
 void setMenuHandler(MenuHandler menuHandler)
           
 void setMinimumPreferredHeight(int minimumPreferredHeight)
          Sets the minimum preferred height of this component.
 void setMinimumPreferredWidth(int minimumPreferredWidth)
          Sets the minimum preferred width of this component.
protected  void setParent(Container parent)
           
 void setPreferredHeight(int preferredHeight)
          Sets the component's preferred height.
 void setPreferredHeightLimits(int minimumPreferredHeight, int maximumPreferredHeight)
          Sets the preferred height limits for this component.
 void setPreferredHeightLimits(Limits preferredHeightLimits)
          Sets the preferred height limits for this component.
 void setPreferredSize(Dimensions preferredSize)
           
 void setPreferredSize(int preferredWidth, int preferredHeight)
          Sets the component's preferred size.
 void setPreferredWidth(int preferredWidth)
          Sets the component's preferred width.
 void setPreferredWidthLimits(int minimumPreferredWidth, int maximumPreferredWidth)
          Sets the preferred width limits for this component.
 void setPreferredWidthLimits(Limits preferredWidthLimits)
          Sets the preferred width limits for this component.
 void setSize(Dimensions size)
           
 void setSize(int width, int height)
          NOTE This method should only be called during layout.
protected  void setSkin(Skin skin)
          Sets the skin, replacing any previous skin.
 void setStyles(Map<String,?> styles)
          Applies a set of styles.
 void setStyles(String styles)
          Applies a set of styles encoded as a JSON string.
 void setStyles(URL styles)
          Applies a set of styles.
 void setTooltipText(String tooltipText)
          Sets the component's tooltip text.
 void setVisible(boolean visible)
          Sets the component's visibility.
 void setWidth(int width)
           
 void setX(int x)
          Sets the component's x-coordinate.
 void setY(int y)
          Sets the component's y-coordinate.
 void store(Dictionary<String,?> context)
          Copies bound values from the component to the bind context.
 void store(Object context)
          Copies bound values from the component to the bind context by converting the given context to a bean dictionary.
 String toString()
           
 Component transferFocus(Direction direction)
          Transfers focus to the next focusable component.
 void validate()
          Lays out the component by calling Skin.layout().
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Component

public Component()
Method Detail

getAutomationID

public String getAutomationID()
Returns the component's automation ID.

Returns:
The component's automation ID, or null if the component does not have an automation ID.

setAutomationID

public void setAutomationID(String automationID)
Sets the component's automation ID. This value can be used to obtain a reference to the component via Automation.get(String) when the component is attached to a component hierarchy.

Parameters:
automationID - The automation ID to use for the component, or null to clear the automation ID.

getSkin

protected Skin getSkin()
Returns the currently installed skin.

Returns:
The currently installed skin.

setSkin

protected void setSkin(Skin skin)
Sets the skin, replacing any previous skin.

Parameters:
skin - The new skin.

installThemeSkin

protected final void installThemeSkin(Class<? extends Component> componentClass)
Installs the skin for the given component class, as defined by the current theme.

Parameters:
componentClass -

getParent

public Container getParent()

setParent

protected void setParent(Container parent)

getWindow

public Window getWindow()

getDisplay

public Display getDisplay()

getWidth

public int getWidth()
Description copied from interface: Visual
Returns the visual's width.

Specified by:
getWidth in interface Visual

setWidth

public void setWidth(int width)

getHeight

public int getHeight()
Description copied from interface: Visual
Returns the visual's height.

Specified by:
getHeight in interface Visual

setHeight

public void setHeight(int height)

getSize

public Dimensions getSize()

setSize

public final void setSize(Dimensions size)

setSize

public void setSize(int width,
                    int height)
NOTE This method should only be called during layout. Callers should use setPreferredSize(int, int).

Specified by:
setSize in interface ConstrainedVisual
Parameters:
width -
height -

getPreferredWidth

public int getPreferredWidth()
Returns the component's unconstrained preferred width.


getPreferredWidth

public int getPreferredWidth(int height)
Returns the component's constrained preferred width.

Specified by:
getPreferredWidth in interface ConstrainedVisual
Parameters:
height - The height value by which the preferred width should be constrained, or -1 for no constraint.
Returns:
The constrained preferred width.

setPreferredWidth

public void setPreferredWidth(int preferredWidth)
Sets the component's preferred width.

Parameters:
preferredWidth - The preferred width value, or -1 to use the default value determined by the skin.

isPreferredWidthSet

public boolean isPreferredWidthSet()
Returns a flag indicating whether the preferred width was explicitly set by the caller or is the default value determined by the skin.

Returns:
true if the preferred width was explicitly set; false, otherwise.

getPreferredHeight

public int getPreferredHeight()
Returns the component's unconstrained preferred height.


getPreferredHeight

public int getPreferredHeight(int width)
Returns the component's constrained preferred height.

Specified by:
getPreferredHeight in interface ConstrainedVisual
Parameters:
width - The width value by which the preferred height should be constrained, or -1 for no constraint.
Returns:
The constrained preferred height.

setPreferredHeight

public void setPreferredHeight(int preferredHeight)
Sets the component's preferred height.

Parameters:
preferredHeight - The preferred height value, or -1 to use the default value determined by the skin.

isPreferredHeightSet

public boolean isPreferredHeightSet()
Returns a flag indicating whether the preferred height was explicitly set by the caller or is the default value determined by the skin.

Returns:
true if the preferred height was explicitly set; false, otherwise.

getPreferredSize

public Dimensions getPreferredSize()
Gets the component's unconstrained preferred size.

Specified by:
getPreferredSize in interface ConstrainedVisual

setPreferredSize

public final void setPreferredSize(Dimensions preferredSize)

setPreferredSize

public void setPreferredSize(int preferredWidth,
                             int preferredHeight)
Sets the component's preferred size.

Parameters:
preferredWidth - The preferred width value, or -1 to use the default value determined by the skin.
preferredHeight - The preferred height value, or -1 to use the default value determined by the skin.

isPreferredSizeSet

public boolean isPreferredSizeSet()
Returns a flag indicating whether the preferred size was explicitly set by the caller or is the default value determined by the skin.

Returns:
true if the preferred size was explicitly set; false, otherwise.

getMinimumPreferredWidth

public int getMinimumPreferredWidth()
Gets the minimum preferred width of this component. A component will always report a preferred size whose width is greater than or equal to its minimum preferred width.

Returns:
The minimum preferred width

setMinimumPreferredWidth

public void setMinimumPreferredWidth(int minimumPreferredWidth)
Sets the minimum preferred width of this component. A component will always report a preferred size whose width is greater than or equal to its minimum preferred width.

Parameters:
minimumPreferredWidth - The minimum preferred width, or -1 to specify no minimum preferred width

getMaximumPreferredWidth

public int getMaximumPreferredWidth()
Gets the maximum preferred width of this component. A component will always report a preferred size whose width is less than or equal to its maximum preferred width.

Returns:
The maximum preferred width

setMaximumPreferredWidth

public void setMaximumPreferredWidth(int maximumPreferredWidth)
Sets the maximum preferred width of this component. A component will always report a preferred size whose width is less than or equal to its maximum preferred width.

Parameters:
maximumPreferredWidth - The maximum preferred width

getPreferredWidthLimits

public Limits getPreferredWidthLimits()
Gets the preferred width limits for this component. A component will always report a preferred size whose width is within these limits.

Returns:
The preferred width limits

setPreferredWidthLimits

public void setPreferredWidthLimits(int minimumPreferredWidth,
                                    int maximumPreferredWidth)
Sets the preferred width limits for this component. A component will always report a preferred size whose width is within these limits.

Parameters:
minimumPreferredWidth - The minimum preferred width for the component
maximumPreferredWidth - The maximum preferred width for the component

setPreferredWidthLimits

public final void setPreferredWidthLimits(Limits preferredWidthLimits)
Sets the preferred width limits for this component. A component will always report a preferred size whose width is within these limits.

Parameters:
preferredWidthLimits - The preferred width limits for the component

getMinimumPreferredHeight

public int getMinimumPreferredHeight()
Gets the minimum preferred height of this component. A component will always report a preferred size whose height is greater than or equal to its minimum preferred height.

Returns:
The minimum preferred height

setMinimumPreferredHeight

public void setMinimumPreferredHeight(int minimumPreferredHeight)
Sets the minimum preferred height of this component. A component will always report a preferred size whose height is greater than or equal to its minimum preferred height.

Parameters:
minimumPreferredHeight - The minimum preferred height

getMaximumPreferredHeight

public int getMaximumPreferredHeight()
Gets the maximum preferred height of this component. A component will always report a preferred size whose height is less than or equal to its maximum preferred height.

Returns:
The maximum preferred height

setMaximumPreferredHeight

public void setMaximumPreferredHeight(int maximumPreferredHeight)
Sets the maximum preferred height of this component. A component will always report a preferred size whose height is less than or equal to its maximum preferred height.

Parameters:
maximumPreferredHeight - The maximum preferred height

getPreferredHeightLimits

public Limits getPreferredHeightLimits()
Gets the preferred height limits for this component. A component will always report a preferred size whose height is within these limits.

Returns:
The preferred height limits

setPreferredHeightLimits

public void setPreferredHeightLimits(int minimumPreferredHeight,
                                     int maximumPreferredHeight)
Sets the preferred height limits for this component. A component will always report a preferred size whose height is within these limits.

Parameters:
minimumPreferredHeight - The minimum preferred height for the component
maximumPreferredHeight - The maximum preferred height for the component

setPreferredHeightLimits

public final void setPreferredHeightLimits(Limits preferredHeightLimits)
Sets the preferred height limits for this component. A component will always report a preferred size whose height is within these limits.

Parameters:
preferredHeightLimits - The preferred height limits for the component

getX

public int getX()
Returns the component's x-coordinate.

Returns:
The component's horizontal position relative to the origin of the parent container.

setX

public void setX(int x)
Sets the component's x-coordinate.

Parameters:
x - The component's horizontal position relative to the origin of the parent container.

getY

public int getY()
Returns the component's y-coordinate.

Returns:
The component's vertical position relative to the origin of the parent container.

setY

public void setY(int y)
Sets the component's y-coordinate.

Parameters:
y - The component's vertical position relative to the origin of the parent container.

getLocation

public Point getLocation()
Returns the component's location.

Returns:
A point value containing the component's horizontal and vertical position relative to the origin of the parent container.

setLocation

public void setLocation(int x,
                        int y)
Sets the component's location. NOTE This method should only be called when performing layout. However, since some containers do not reposition components during layout, it is valid for callers to invoke this method directly when such containers.

Parameters:
x - The component's horizontal position relative to the origin of the parent container.
y - The component's vertical position relative to the origin of the parent container.

setLocation

public final void setLocation(Point location)
Sets the component's location.

Parameters:
location - A point value containing the component's horizontal and vertical position relative to the origin of the parent container.
See Also:
setLocation(int, int)

getBaseline

public int getBaseline()
Returns the component's baseline.

Specified by:
getBaseline in interface Visual
Returns:
The baseline relative to the origin of this component, or -1 if this component does not have a baseline.

getBaseline

public int getBaseline(int width,
                       int height)
Returns the component's baseline for a given width and height.

Specified by:
getBaseline in interface ConstrainedVisual
Returns:
The baseline relative to the origin of this component, or -1 if this component does not have a baseline.

getBounds

public Bounds getBounds()
Returns the component's bounding area.

Returns:
The component's bounding area. The x and y values are relative to the parent container.

getDecoratedBounds

public Bounds getDecoratedBounds()
Returns the component's bounding area including decorators.

Returns:
The decorated bounding area. The x and y values are relative to the parent container.

isVisible

public boolean isVisible()
Returns the component's visibility.

Returns:
true if the component will be painted; false, otherwise.

setVisible

public void setVisible(boolean visible)
Sets the component's visibility.

Parameters:
visible - true if the component should be painted; false, otherwise.

getDecorators

public Component.DecoratorSequence getDecorators()
Returns the component's decorator sequence.

Returns:
The component's decorator sequence

mapPointToAncestor

public Point mapPointToAncestor(Container ancestor,
                                int x,
                                int y)
Maps a point in this component's coordinate system to the specified ancestor's coordinate space.

Parameters:
x - The x-coordinate in this component's coordinate space
y - The y-coordinate in this component's coordinate space
Returns:
A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.

mapPointFromAncestor

public Point mapPointFromAncestor(Container ancestor,
                                  int x,
                                  int y)
Maps a point in the specified ancestor's coordinate space to this component's coordinate system.

Parameters:
x - The x-coordinate in the ancestors's coordinate space.
y - The y-coordinate in the ancestor's coordinate space.
Returns:
A point containing the translated coordinates, or null if the component is not a descendant of the specified ancestor.

isShowing

public boolean isShowing()
Determines if this component is showing. To be showing, the component and all of its ancestors must be visible, and the component's window must be open.

Returns:
true if this component is showing; false otherwise

getVisibleArea

public Bounds getVisibleArea()
Determines the visible area of a component. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.

Returns:
The visible area of the component in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.

getVisibleArea

public Bounds getVisibleArea(Bounds area)
Determines the visible area of a component. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.

Parameters:
area -
Returns:
The visible area of the component in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.

getVisibleArea

public Bounds getVisibleArea(int x,
                             int y,
                             int width,
                             int height)
Determines the visible area of a component. The visible area is defined as the intersection of the component's area with the visible area of its ancestors, or, in the case of a Viewport, the viewport bounds.

Parameters:
x -
y -
width -
height -
Returns:
The visible area of the component in the component's coordinate space, or null if the component is either not showing or not part of the component hierarchy.

scrollAreaToVisible

public void scrollAreaToVisible(Bounds area)
Ensures that the given area of a component is visible within the viewports of all applicable ancestors.

Parameters:
area -

scrollAreaToVisible

public void scrollAreaToVisible(int x,
                                int y,
                                int width,
                                int height)
Ensures that the given area of a component is visible within the viewports of all applicable ancestors.

Parameters:
x -
y -
width -
height -

isValid

public boolean isValid()
Returns the component's valid state.


invalidate

public void invalidate()
Flags the component's hierarchy as invalid, and clears any cached preferred size.


validate

public void validate()
Lays out the component by calling Skin.layout().


layout

protected void layout()
Called to lay out the component.


repaint

public final void repaint()
Flags the entire component as needing to be repainted.


repaint

public final void repaint(boolean immediate)
Flags the entire component as needing to be repainted.

Parameters:
immediate -

repaint

public final void repaint(Bounds area)
Flags an area as needing to be repainted.

Parameters:
area -

repaint

public final void repaint(Bounds area,
                          boolean immediate)
Flags an area as needing to be repainted or repaints the rectangle immediately.

Parameters:
area -
immediate -

repaint

public final void repaint(int x,
                          int y,
                          int width,
                          int height)
Flags an area as needing to be repainted.

Parameters:
x -
y -
width -
height -

repaint

public void repaint(int x,
                    int y,
                    int width,
                    int height,
                    boolean immediate)
Flags an area as needing to be repainted.

Parameters:
x -
y -
width -
height -
immediate -

paint

public void paint(Graphics2D graphics)
Paints the component. Delegates to the skin.

Specified by:
paint in interface Visual
Parameters:
graphics - The graphics context in which to paint the visual.

getGraphics

public Graphics2D getGraphics()
Creates a graphics context for this component. This graphics context will not be double buffered. In other words, drawing operations on it will operate directly on the video RAM.

Returns:
A graphics context for this component, or null if this component is not showing.
See Also:
isShowing()

isEnabled

public boolean isEnabled()
Returns the component's enabled state.

Returns:
true if the component is enabled; false, otherwise.

setEnabled

public void setEnabled(boolean enabled)
Sets the component's enabled state. Enabled components respond to user input events; disabled components do not.

Parameters:
enabled - true if the component is enabled; false, otherwise.

isBlocked

public boolean isBlocked()
Determines if this component is blocked. A component is blocked if the component or any of its ancestors is disabled.

Returns:
true if the component is blocked; false, otherwise.

isMouseOver

public boolean isMouseOver()
Determines if the mouse is positioned over this component.

Returns:
true if the mouse is currently located over this component; false, otherwise.

getCursor

public Cursor getCursor()
Returns the cursor that is displayed when the mouse pointer is over this component.

Returns:
The cursor that is displayed over the component.

setCursor

public void setCursor(Cursor cursor)
Sets the cursor that is displayed when the mouse pointer is over this component.

Parameters:
cursor - The cursor to display over the component, or null to inherit the cursor of the parent container.

setCursor

public final void setCursor(String cursor)

getTooltipText

public String getTooltipText()
Returns the component's tooltip text.

Returns:
The component's tooltip text, or null if no tooltip is specified.

setTooltipText

public void setTooltipText(String tooltipText)
Sets the component's tooltip text.

Parameters:
tooltipText - The component's tooltip text, or null for no tooltip.

isOpaque

public boolean isOpaque()
Tells whether or not this component is fully opaque when painted.

Returns:
true if this component is opaque; false if any part of it is transparent or translucent.

isFocusable

public boolean isFocusable()
Returns this component's focusability. A focusable component is capable of receiving the focus only when it is showing and enabled.

Returns:
true if the component is capable of receiving the focus

isFocused

public boolean isFocused()
Returns the component's focused state.

Returns:
true if the component has the input focus; false otherwise.

requestFocus

public boolean requestFocus()
Requests that focus be given to this component.

Returns:
true if the component gained the focus; false otherwise.

transferFocus

public Component transferFocus(Direction direction)
Transfers focus to the next focusable component.

Parameters:
direction - The direction in which to transfer focus.

getFocusedComponent

public static Component getFocusedComponent()
Returns the currently focused component.

Returns:
The component that currently has the focus, or null if no component is focused.

clearFocus

public static void clearFocus()
Clears the focus.


load

public void load(Dictionary<String,?> context)
Copies bound values from the bind context to the component. This functionality must be provided by the subclass; the base implementation is a no-op.

Parameters:
context -

load

public final void load(Object context)
Copies bound values from the bind context to the component by converting the given context to a bean dictionary.

Parameters:
context -

store

public void store(Dictionary<String,?> context)
Copies bound values from the component to the bind context. This functionality must be provided by the subclass; the base implementation is a no-op.

Parameters:
context -

store

public final void store(Object context)
Copies bound values from the component to the bind context by converting the given context to a bean dictionary.

Parameters:
context -

clear

public void clear()
Clears any bound values in the component.


getDragSource

public DragSource getDragSource()

setDragSource

public void setDragSource(DragSource dragSource)

getDropTarget

public DropTarget getDropTarget()

setDropTarget

public void setDropTarget(DropTarget dropTarget)

getMenuHandler

public MenuHandler getMenuHandler()

setMenuHandler

public void setMenuHandler(MenuHandler menuHandler)

getUserData

public Component.UserDataDictionary getUserData()
Returns the user data dictionary.


getStyles

public final Component.StyleDictionary getStyles()
Returns a dictionary instance representing the component's style properties. This is effectively a pass-through to the skin's dictionary implementation. It allows callers to modify the properties of the skin without directly obtaining a reference to the skin.


setStyles

public void setStyles(Map<String,?> styles)
Applies a set of styles.

Parameters:
styles -

setStyles

public void setStyles(URL styles)
               throws IOException,
                      SerializationException
Applies a set of styles.

Parameters:
styles - The location of the styles to apply. If the styles have been previously applied, they will be retrieved from the resource cache in the application context. Otherwise, they will be loaded from the given location and added to the cache before being applied.
Throws:
IOException
SerializationException

setStyles

public void setStyles(String styles)
Applies a set of styles encoded as a JSON string.

Parameters:
styles -

getAttributes

protected Object getAttributes()
Returns the component's attributes.

Returns:
The component's attributes, or null if no attributes are installed.

setAttributes

protected void setAttributes(Object attributes)
Sets the component's attributes.

Parameters:
attributes -

reenterMouse

public void reenterMouse()
If the mouse is currently over the component, causes the component to fire mouseOut() and a mouseMove() at the current mouse location.

This method is primarily useful when consuming container mouse motion events, since it allows a caller to reset the mouse state based on the event consumption logic.


mouseMove

protected boolean mouseMove(int x,
                            int y)

mouseOver

protected void mouseOver()

mouseOut

protected void mouseOut()

mouseDown

protected boolean mouseDown(Mouse.Button button,
                            int x,
                            int y)

mouseUp

protected boolean mouseUp(Mouse.Button button,
                          int x,
                          int y)

mouseClick

protected boolean mouseClick(Mouse.Button button,
                             int x,
                             int y,
                             int count)

mouseWheel

protected boolean mouseWheel(Mouse.ScrollType scrollType,
                             int scrollAmount,
                             int wheelRotation,
                             int x,
                             int y)

keyTyped

protected boolean keyTyped(char character)

keyPressed

protected boolean keyPressed(int keyCode,
                             Keyboard.KeyLocation keyLocation)

keyReleased

protected boolean keyReleased(int keyCode,
                              Keyboard.KeyLocation keyLocation)

toString

public String toString()
Overrides:
toString in class Object

getComponentListeners

public ListenerList<ComponentListener> getComponentListeners()

getComponentStateListeners

public ListenerList<ComponentStateListener> getComponentStateListeners()

getComponentDecoratorListeners

public ListenerList<ComponentDecoratorListener> getComponentDecoratorListeners()

getComponentMouseListeners

public ListenerList<ComponentMouseListener> getComponentMouseListeners()

getComponentMouseButtonListeners

public ListenerList<ComponentMouseButtonListener> getComponentMouseButtonListeners()

getComponentMouseWheelListeners

public ListenerList<ComponentMouseWheelListener> getComponentMouseWheelListeners()

getComponentKeyListeners

public ListenerList<ComponentKeyListener> getComponentKeyListeners()

getComponentDataListeners

public ListenerList<ComponentDataListener> getComponentDataListeners()

getComponentClassListeners

public static ListenerList<ComponentClassListener> getComponentClassListeners()