Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit
Class Component

java.lang.Object
  extended by com.sun.dtv.lwuit.Component
All Implemented Interfaces:
Animation, StyleListener, Animated
Direct Known Subclasses:
AWTComponent, Container, Label, List, MediaComponent, TextArea

public class Component
extends Object
implements Animation, Animated, StyleListener

Base class for all the widgets in the toolkit using the composite pattern in a similar way to the AWT Container/Component relationship. All components are potentially animated (need to be registered in Form).

See Also:
Form.registerAnimation(com.sun.dtv.lwuit.animations.Animation)

Field Summary
static int BOTTOM
          Box-orientation constant used to specify the bottom of a box.
static int BRB_CENTER_OFFSET
          Baseline resize behavior constant used to properly align components.
static int BRB_CONSTANT_ASCENT
          Baseline resize behavior constant used to properly align components.
static int BRB_CONSTANT_DESCENT
          Baseline resize behavior constant used to properly align components.
static int BRB_OTHER
          Baseline resize behavior constant used to properly align components.
static int CENTER
          Indicates a Component center alignment.
static int LEFT
          Box-orientation constant used to specify the left side of a box.
static int RIGHT
          Box-orientation constant used to specify the right side of a box.
static int TOP
          Box-orientation constant used to specify the top of a box.
 
Fields inherited from interface com.sun.dtv.ui.Animated
ALTERNATING, LOOP, REPEATING
 
Constructor Summary
protected Component()
          Creates a new instance of Component.
 
Method Summary
 void addFocusListener(FocusListener l)
          Registers interest in receiving callbacks for focus gained events, a focus event is invoked when the component accepts the focus.
 boolean animate()
          Allows the animation to reduce "repaint" calls when it returns false.
protected  Dimension calcPreferredSize()
          Calculates the preferred size based on component content.
 boolean contains(int x, int y)
          Returns true if the given absolute coordinate is contained in the Component.
protected  void deinitialize()
          Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy.
 int getAbsoluteX()
          Returns the absolute X location based on the component hierarchy, this method calculates a location on the screen for the component rather than a relative location as returned by getX().
 int getAbsoluteY()
          Returns the absolute Y location based on the component hierarchy, this method calculates a location on the screen for the component rather than a relative location as returned by getY().
 int getAnimationMode()
          Obtains the animation mode for this animation.
 int getBaseline(int width, int height)
          The baseline for the component text according to which it should be aligned with other components for best visual look.
 int getBaselineResizeBehavior()
          Returns a constant indicating how the baseline varies with the size of the component.
 int getBottomGap()
          Returns the gap to be left for the bottom scrollbar on the X axis.
 Rectangle getBounds()
          Returns the component bounds which is sometimes more convenient than invoking getX/Y/Width/Height.
 Object getClientProperty(String key)
          Client properties allow the association of meta-data with a component, this is useful for some applications that construct GUI's on the fly and need to track the connection between the UI and the data.
 Form getComponentForm()
          Returns the Component Form or null if this Component is not added to a form.
 int getDelay()
          Obtains the delay after every image for this animation when running.
 int getHeight()
          Returns the component height.
 Component getNextFocusDown()
          Allows us to determine which component will receive focus next when traversing with the down key.
 Component getNextFocusLeft()
          Allows us to determine which component will receive focus next when traversing with the left key.
 Component getNextFocusRight()
          Allows us to determine which component will receive focus next when traversing with the right key.
 Component getNextFocusUp()
          Allows us to determine which component will receive focus next when traversing with the up key.
 Container getParent()
          Returns the container in which this component is contained.
 int getPosition()
          Obtains the current position the animation is at the point of time of th method call.
 Dimension getPreferredSize()
          Returns the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size.
 int getRepetitionMode()
          Returns the repetition mode of this animation in form of a number.
 int getScrollAnimationSpeed()
          Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode.
 int getScrollX()
          Indicates the X position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.
 int getScrollY()
          Indicates the Y position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.
 int getSideGap()
          Returns the gap to be left for the side scrollbar on the Y axis.
 Style getStyle()
          Returns the Component Style allowing us to manipulate the look of the component.
 String getUIID()
          Retrieves unique identifier for a component, must be overriden for a component so a style can be applied to the component
 int getWidth()
          Returns the component width.
 int getX()
          Returns the current component x location relatively to its parent container.
 int getY()
          Returns the component y location relatively to its parent container.
 boolean handlesInput()
          Prevents key events from being grabbed for focus traversal.
 boolean hasFocus()
          Returns true if the component has focus.
protected  void initialize()
          Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
 boolean isEnabled()
          Indicates whether component is enabled or disabled thus allowing us to prevent a component from receiving input events and indicate so visually.
 boolean isFocusable()
          Returns true if this component can receive focus and is enabled.
 boolean isFocusPainted()
          Indicates whether focus should be drawn around the component or whether it will handle its own focus painting.
protected  boolean isInitialized()
          Indicates if the component is in the initialized state, a component is initialized when its initialize method has been invoked.
 boolean isRunning()
          Obtains the running mode of an animation.
 boolean isScrollableX()
          Indicates whether the component should/could scroll on the X axis.
 boolean isScrollableY()
          Indicates whether the component should/could scroll on the Y axis.
 boolean isScrollVisible()
          Indicate whether this component scroll is visible.
 boolean isSmoothScrolling()
          Indicates that scrolling through the component should work as an animation.
 boolean isVisible()
          Returns whether the component is visible or not.
 void jumpTo(int position)
          Forces an animation to jump to the position indicated by the parameter.
 void keyPressed(int keyCode)
          If this Component is focused, the key pressed event will call this method.
 void keyReleased(int keyCode)
          If this Component is focused, the key released event will call this method.
 void keyRepeated(int keyCode)
          If this Component is focused, the key repeat event will call this method.
 void longKeyPress(int keyCode)
          If this Component is focused this method is invoked when the user presses and holds the key.
 void paint(Graphics g)
          This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.
 void paintBackgrounds(Graphics g)
          This method paints all the parents Components Background.
 void paintComponent(Graphics g)
          Paints this component as a root by going to all the parent components and setting the absolute translation based on coordinates and scroll status.
 void paintComponent(Graphics g, boolean background)
          Paints this component as a root by going to all the parent components and setting the absolute translation based on coordinates and scroll status.
 void pointerDragged(int x, int y)
          If this Component is focused, the pointer dragged event will call this method.
 void pointerPressed(int x, int y)
          If this Component is focused, the pointer pressed event will call this method.
 void pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method.
 void putClientProperty(String key, Object value)
          Client properties allow the association of meta-data with a component, this is useful for some applications that construct GUI's on the fly and need to track the connection between the UI and the data.
 void refreshTheme()
          Makes sure the component is up to date with the current style object.
 void removeFocusListener(FocusListener l)
          Deregisters interest in receiving callbacks for focus gained events.
 void repaint()
          Repaint this Component, the repaint call causes a callback of the paint method on the event dispatch thread.
 void repaint(int x, int y, int w, int h)
          Repaint the specified area of this Component.
 void requestFocus()
          Changes the current component to the focused component, will work only for a component that belongs to a parent form.
protected  void scrollRectToVisible(Rectangle rect, Component coordinateSpace)
          Makes sure the component is visible in the scroll if this container is scrollable
 void setAnimationMode(int mode)
          Sets the animation mode for this animation.
 void setCellRenderer(boolean cellRenderer)
          Used as an optimization to mark that this component is currently being used as a cell renderer.
 void setDelay(int n)
          Determines the delay after every image when running this animation.
 void setEnabled(boolean enabled)
          Indicates whether component is enabled or disabled thus allowing us to prevent a component from receiving input events and indicate so visually.
 void setFocus(boolean focused)
          This flag doesn't really give focus, its a state that determines what colors from the Style should be used when painting the component.
 void setFocusable(boolean focusable)
          A simple setter to determine if this Component can get focused.
 void setFocusPainted(boolean focusPainted)
          Indicates whether focus should be drawn around the component or whether it will handle its own focus painting.
 void setHandlesInput(boolean handlesInput)
          Prevents key events from being grabbed for focus traversal.
 void setHeight(int height)
          Sets the Component height, this method is exposed for the purpose of external layout managers and should not be invoked directly.
protected  void setInitialized(boolean initialized)
          Needed to support the concept of initialization.
 void setIsScrollVisible(boolean isScrollVisible)
          Set whether this component scroll is visible.
 void setNextFocusDown(Component nextFocusDown)
          Allows us to determine which component will receive focus next when traversing with the down key.
 void setNextFocusLeft(Component nextFocusLeft)
          Allows us to determine which component will receive focus next when traversing with the left key, this method doesn't affect the general focus behavior.
 void setNextFocusRight(Component nextFocusRight)
          Allows us to determine which component will receive focus next when traversing with the right key.
 void setNextFocusUp(Component nextFocusUp)
          Allows us to determine which component will receive focus next when traversing with the up key, this method doesn't affect the general focus behavior.
 void setPreferredSize(Dimension d)
          Sets the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size.
 void setRepetitionMode(int n)
          Determines how often the animation is repeated once it has been started.
 void setScrollAnimationSpeed(int animationSpeed)
          Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode.
protected  void setScrollX(int scrollX)
          Indicates the X position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.
protected  void setScrollY(int scrollY)
          Indicates the Y position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the y position of the component.
protected  void setShouldCalcPreferredSize(boolean shouldCalcPreferredSize)
          Indicates the values within the component have changed and preferred size should be recalculated
 void setSize(Dimension d)
          Sets the Component size, this method is exposed for the purpose of external layout managers and should not be invoked directly.
 void setSmoothScrolling(boolean smoothScrolling)
          Indicates that scrolling through the component should work as an animation.
 void setStyle(Style style)
          Changes the Component Style by replacing the Component Style with the given Style.
 void setUIID(String uiid)
          Sets unique identifier for a component, as it is retrieved using getUIID.
 void setVisible(boolean visible)
          Toggles visibility of the component.
 void setWidth(int width)
          Sets the Component width, this method is exposed for the purpose of external layout managers and should not be invoked directly.
 void setX(int x)
          Sets the Component x location relative to the parent container, this method is exposed for the purpose of external layout managers and should not be invoked directly.
 void setY(int y)
          Sets the Component y location relative to the parent container, this method is exposed for the purpose of external layout managers and should not be invoked directly.
 void start()
          Starts an animation.
 void stop()
          Stops an animation.
 void styleChanged(String propertyName, Style source)
          Invoked to indicate a change in a propertyName of a Style.
 String toString()
          Overriden to return a useful value for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BRB_CONSTANT_ASCENT

public static final int BRB_CONSTANT_ASCENT
Baseline resize behavior constant used to properly align components. Indicates as the size of the component changes the baseline remains a fixed distance from the top of the component.

See Also:
getBaselineResizeBehavior(), Constant Field Values

BRB_CONSTANT_DESCENT

public static final int BRB_CONSTANT_DESCENT
Baseline resize behavior constant used to properly align components. Indicates as the size of the component changes the baseline remains a fixed distance from the bottom of the component.

See Also:
getBaselineResizeBehavior(), Constant Field Values

BRB_CENTER_OFFSET

public static final int BRB_CENTER_OFFSET
Baseline resize behavior constant used to properly align components. Indicates as the size of the component changes the baseline remains a fixed distance from the center of the component.

See Also:
getBaselineResizeBehavior(), Constant Field Values

BRB_OTHER

public static final int BRB_OTHER
Baseline resize behavior constant used to properly align components. Indicates as the size of the component changes the baseline can not be determined using one of the other constants.

See Also:
getBaselineResizeBehavior(), Constant Field Values

CENTER

public static final int CENTER
Indicates a Component center alignment.

See Also:
Constant Field Values

TOP

public static final int TOP
Box-orientation constant used to specify the top of a box.

See Also:
Constant Field Values

LEFT

public static final int LEFT
Box-orientation constant used to specify the left side of a box.

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Box-orientation constant used to specify the bottom of a box.

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Box-orientation constant used to specify the right side of a box.

See Also:
Constant Field Values
Constructor Detail

Component

protected Component()
Creates a new instance of Component.

Method Detail

getX

public int getX()
Returns the current component x location relatively to its parent container.

Returns:
the current x coordinate of the components origin
See Also:
setX(int)

getY

public int getY()
Returns the component y location relatively to its parent container.

Returns:
the current y coordinate of the components origin
See Also:
setY(int)

isVisible

public boolean isVisible()
Returns whether the component is visible or not.

Returns:
true if component is visible; otherwise false

getClientProperty

public Object getClientProperty(String key)
Client properties allow the association of meta-data with a component, this is useful for some applications that construct GUI's on the fly and need to track the connection between the UI and the data.

Parameters:
key - the key used for putClientProperty
Returns:
the value set to putClientProperty or null if no value is set to the property

putClientProperty

public void putClientProperty(String key,
                              Object value)
Client properties allow the association of meta-data with a component, this is useful for some applications that construct GUI's on the fly and need to track the connection between the UI and the data. Setting the value to null will remove the client property from the component.

Parameters:
key - arbitrary key for the property
value - the value assigned to the given client property

setVisible

public void setVisible(boolean visible)
Toggles visibility of the component.

Parameters:
visible - true if component is visible; otherwise false

getWidth

public int getWidth()
Returns the component width.

Returns:
the component width
See Also:
setWidth(int)

getHeight

public int getHeight()
Returns the component height.

Returns:
the component height
See Also:
setHeight(int)

setX

public void setX(int x)
Sets the Component x location relative to the parent container, this method is exposed for the purpose of external layout managers and should not be invoked directly.

Parameters:
x - the current x coordinate of the components origin
See Also:
getX()

setY

public void setY(int y)
Sets the Component y location relative to the parent container, this method is exposed for the purpose of external layout managers and should not be invoked directly.

Parameters:
y - the current y coordinate of the components origin
See Also:
getY()

getBaseline

public int getBaseline(int width,
                       int height)
The baseline for the component text according to which it should be aligned with other components for best visual look.

Parameters:
width - the component width
height - the component height
Returns:
baseline value from the top of the component

getBaselineResizeBehavior

public int getBaselineResizeBehavior()
Returns a constant indicating how the baseline varies with the size of the component.

Returns:
one of BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_CENTER_OFFSET or BRB_OTHER

setPreferredSize

public void setPreferredSize(Dimension d)
Sets the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size. The final size of the component may be smaller than its preferred size or even larger than the size.
The Layout manager can take this value into consideration, but there is no guarantee or requirement.

Parameters:
d - the component dimension
See Also:
getPreferredSize()

getPreferredSize

public Dimension getPreferredSize()
Returns the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size. The final size of the component may be smaller than its preferred size or even larger than the size.
The Layout manager can take this value into consideration, but there is no guarantee or requirement.

Returns:
the component preferred size
See Also:
setPreferredSize(com.sun.dtv.lwuit.geom.Dimension)

calcPreferredSize

protected Dimension calcPreferredSize()
Calculates the preferred size based on component content. This method is invoked lazily by getPreferredSize.

Returns:
the calculated preferred size based on component content

setWidth

public void setWidth(int width)
Sets the Component width, this method is exposed for the purpose of external layout managers and should not be invoked directly.
If a user wishes to effect the component size setPreferredSize should be used.

Parameters:
width - the width of the component
See Also:
getWidth(), setPreferredSize(com.sun.dtv.lwuit.geom.Dimension)

setHeight

public void setHeight(int height)
Sets the Component height, this method is exposed for the purpose of external layout managers and should not be invoked directly.
If a user wishes to effect the component size setPreferredSize should be used.

Parameters:
height - the height of the component
See Also:
getHeight(), setPreferredSize(com.sun.dtv.lwuit.geom.Dimension)

setSize

public void setSize(Dimension d)
Sets the Component size, this method is exposed for the purpose of external layout managers and should not be invoked directly.
If a user wishes to effect the component size setPreferredSize should be used.

Parameters:
d - the component dimension
See Also:
setPreferredSize(com.sun.dtv.lwuit.geom.Dimension)

getParent

public Container getParent()
Returns the container in which this component is contained.

Returns:
the parent container in which this component is contained

addFocusListener

public void addFocusListener(FocusListener l)
Registers interest in receiving callbacks for focus gained events, a focus event is invoked when the component accepts the focus. A special case exists for the Form which sends a focus even for every selection within the form.

Parameters:
l - listener interface implementing the observable pattern
See Also:
removeFocusListener(com.sun.dtv.lwuit.events.FocusListener)

removeFocusListener

public void removeFocusListener(FocusListener l)
Deregisters interest in receiving callbacks for focus gained events.

Parameters:
l - listener interface implementing the observable pattern
See Also:
addFocusListener(com.sun.dtv.lwuit.events.FocusListener)

paintBackgrounds

public void paintBackgrounds(Graphics g)
This method paints all the parents Components Background.

Parameters:
g - the graphics object

getAbsoluteX

public int getAbsoluteX()
Returns the absolute X location based on the component hierarchy, this method calculates a location on the screen for the component rather than a relative location as returned by getX().

Returns:
the absolute x location of the component
See Also:
getX()

getAbsoluteY

public int getAbsoluteY()
Returns the absolute Y location based on the component hierarchy, this method calculates a location on the screen for the component rather than a relative location as returned by getY().

Returns:
the absolute y location of the component
See Also:
getY()

paintComponent

public final void paintComponent(Graphics g)
Paints this component as a root by going to all the parent components and setting the absolute translation based on coordinates and scroll status. Restores translation when the painting is finished.

Parameters:
g - the graphics to paint this Component on

paintComponent

public final void paintComponent(Graphics g,
                                 boolean background)
Paints this component as a root by going to all the parent components and setting the absolute translation based on coordinates and scroll status. Restores translation when the painting is finished.

Parameters:
g - the graphics to paint this Component on
background - if true paints all parents background

paint

public void paint(Graphics g)
This method paints the Component on the screen, it should be overriden by subclasses to perform custom drawing or invoke the UI API's to let the PLAF perform the rendering.

Specified by:
paint in interface Animation
Parameters:
g - the component graphics

isScrollableX

public boolean isScrollableX()
Indicates whether the component should/could scroll on the X axis.

Returns:
whether the component is scrollable on the X axis

isScrollableY

public boolean isScrollableY()
Indicates whether the component should/could scroll on the Y axis.

Returns:
whether the component is scrollable on the X axis

getScrollX

public int getScrollX()
Indicates the X position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.

Returns:
the X position of the scrolling

getScrollY

public int getScrollY()
Indicates the Y position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.

Returns:
the Y position of the scrolling

getBottomGap

public int getBottomGap()
Returns the gap to be left for the bottom scrollbar on the X axis. This method is used by layout managers to determine the room they should leave for the scrollbar

Returns:
the gap to be left for the bottom scrollbar on the X axis

getSideGap

public int getSideGap()
Returns the gap to be left for the side scrollbar on the Y axis. This method is used by layout managers to determine the room they should leave for the scrollbar. (note: side scrollbar rather than left scrollbar is used for a future version that would support bidi).

Returns:
the gap to be left for the side scrollbar on the Y axis

contains

public boolean contains(int x,
                        int y)
Returns true if the given absolute coordinate is contained in the Component.

Parameters:
x - the given absolute x coordinate
y - the given absolute y coordinate
Returns:
true if the given absolute coordinate is contained in the Component; otherwise false

getBounds

public Rectangle getBounds()
Returns the component bounds which is sometimes more convenient than invoking getX/Y/Width/Height. Bounds are relative to parent container.
Changing values within the bounds can lead to unpredicted behavior.

Returns:
the component bounds
See Also:
getX(), getY()

isFocusable

public boolean isFocusable()
Returns true if this component can receive focus and is enabled.

Returns:
true if this component can receive focus; otherwise false

setFocusable

public void setFocusable(boolean focusable)
A simple setter to determine if this Component can get focused.

Parameters:
focusable - indicate whether this component can get focused

isFocusPainted

public boolean isFocusPainted()
Indicates whether focus should be drawn around the component or whether it will handle its own focus painting.

Returns:
true if focus should be drawn around the component ; otherwise false

setFocusPainted

public void setFocusPainted(boolean focusPainted)
Indicates whether focus should be drawn around the component or whether it will handle its own focus painting.

Parameters:
focusPainted - indicates whether focus should be drawn around the component

handlesInput

public boolean handlesInput()
Prevents key events from being grabbed for focus traversal. E.g. a list component might use the arrow keys for internal navigation so it will switch this flag to true in order to prevent the focus manager from moving to the next component.

Returns:
true if key events are being used for focus traversal ; otherwise false

setHandlesInput

public void setHandlesInput(boolean handlesInput)
Prevents key events from being grabbed for focus traversal. E.g. a list component might use the arrow keys for internal navigation so it will switch this flag to true in order to prevent the focus manager from moving to the next component.

Parameters:
handlesInput - indicates whether key events can be grabbed for focus traversal

hasFocus

public boolean hasFocus()
Returns true if the component has focus.

Returns:
true if the component has focus; otherwise false
See Also:
setFocus(boolean)

setFocus

public void setFocus(boolean focused)
This flag doesn't really give focus, its a state that determines what colors from the Style should be used when painting the component. Actual focus is determined by the parent Container.

Parameters:
focused - sets the state that determines what colors from the Style should be used when painting a focused component
See Also:
requestFocus()

getComponentForm

public Form getComponentForm()
Returns the Component Form or null if this Component is not added to a form.

Returns:
the Component Form

repaint

public void repaint()
Repaint this Component, the repaint call causes a callback of the paint method on the event dispatch thread.


repaint

public void repaint(int x,
                    int y,
                    int w,
                    int h)
Repaint the specified area of this Component.

Parameters:
x - the x coordinate of the upper left corner
y - the y coordinate of the upper left corner
w - the width of the area
h - the height of the area

longKeyPress

public void longKeyPress(int keyCode)
If this Component is focused this method is invoked when the user presses and holds the key.

Parameters:
keyCode - the key code value to indicate a physical key.

keyPressed

public void keyPressed(int keyCode)
If this Component is focused, the key pressed event will call this method.

Parameters:
keyCode - the key code value to indicate a physical key.

keyReleased

public void keyReleased(int keyCode)
If this Component is focused, the key released event will call this method.

Parameters:
keyCode - the key code value to indicate a physical key.

keyRepeated

public void keyRepeated(int keyCode)
If this Component is focused, the key repeat event will call this method. Calls key pressed/released by default.

Parameters:
keyCode - the key code value to indicate a physical key.

getScrollAnimationSpeed

public int getScrollAnimationSpeed()
Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode.

Returns:
scroll animation speed in milliseconds
See Also:
setScrollAnimationSpeed(int)

setScrollAnimationSpeed

public void setScrollAnimationSpeed(int animationSpeed)
Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode.

Parameters:
animationSpeed - scroll animation speed in milliseconds
See Also:
getScrollAnimationSpeed()

isSmoothScrolling

public boolean isSmoothScrolling()
Indicates that scrolling through the component should work as an animation.

Returns:
whether this component use smooth scrolling

setSmoothScrolling

public void setSmoothScrolling(boolean smoothScrolling)
Indicates that scrolling through the component should work as an animation.

Parameters:
smoothScrolling - indicates if a component uses smooth scrolling

pointerDragged

public void pointerDragged(int x,
                           int y)
If this Component is focused, the pointer dragged event will call this method.

Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerPressed

public void pointerPressed(int x,
                           int y)
If this Component is focused, the pointer pressed event will call this method.

Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerReleased

public void pointerReleased(int x,
                            int y)
If this Component is focused, the pointer released event will call this method.

Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

getStyle

public Style getStyle()
Returns the Component Style allowing us to manipulate the look of the component.

Returns:
the component Style object
See Also:
setStyle(com.sun.dtv.lwuit.plaf.Style)

setStyle

public void setStyle(Style style)
Changes the Component Style by replacing the Component Style with the given Style.

Parameters:
style - the component Style object
See Also:
getStyle()

requestFocus

public void requestFocus()
Changes the current component to the focused component, will work only for a component that belongs to a parent form.


toString

public String toString()
Overriden to return a useful value for debugging purposes. Overrides Object.toString.

Overrides:
toString in class Object
Returns:
a string representation of this component

refreshTheme

public void refreshTheme()
Makes sure the component is up to date with the current style object.


animate

public boolean animate()
Description copied from interface: Animation
Allows the animation to reduce "repaint" calls when it returns false. It is called once for every frame.

Specified by:
animate in interface Animation
Returns:
true if a repaint is desired or false if no repaint is necessary

setCellRenderer

public void setCellRenderer(boolean cellRenderer)
Used as an optimization to mark that this component is currently being used as a cell renderer.

Parameters:
cellRenderer - indicate whether this component is currently being used as a cell renderer

isScrollVisible

public boolean isScrollVisible()
Indicate whether this component scroll is visible.

Returns:
true is this component scroll is visible; otherwise false

setIsScrollVisible

public void setIsScrollVisible(boolean isScrollVisible)
Set whether this component scroll is visible.

Parameters:
isScrollVisible - Indicate whether this component scroll is visible

styleChanged

public void styleChanged(String propertyName,
                         Style source)
Description copied from interface: StyleListener
Invoked to indicate a change in a propertyName of a Style.

Specified by:
styleChanged in interface StyleListener
Parameters:
propertyName - the property name that was changed
source - The changed Style object

getNextFocusDown

public Component getNextFocusDown()
Allows us to determine which component will receive focus next when traversing with the down key.

Returns:
the Component will receive focus next when traversing with the down key
See Also:
setNextFocusDown(com.sun.dtv.lwuit.Component)

setNextFocusDown

public void setNextFocusDown(Component nextFocusDown)
Allows us to determine which component will receive focus next when traversing with the down key.

Parameters:
nextFocusDown - the Component which will receive focus next when traversing with the down key
See Also:
getNextFocusDown()

getNextFocusUp

public Component getNextFocusUp()
Allows us to determine which component will receive focus next when traversing with the up key.

Returns:
the Component will receive focus next when traversing with the up key
See Also:
setNextFocusUp(com.sun.dtv.lwuit.Component)

setNextFocusUp

public void setNextFocusUp(Component nextFocusUp)
Allows us to determine which component will receive focus next when traversing with the up key, this method doesn't affect the general focus behavior.

Parameters:
nextFocusUp - the Component which will receive focus next when traversing with the up key
See Also:
getNextFocusUp()

getNextFocusLeft

public Component getNextFocusLeft()
Allows us to determine which component will receive focus next when traversing with the left key.

Returns:
the Component will receive focus next when traversing with the left key
See Also:
setNextFocusLeft(com.sun.dtv.lwuit.Component)

setNextFocusLeft

public void setNextFocusLeft(Component nextFocusLeft)
Allows us to determine which component will receive focus next when traversing with the left key, this method doesn't affect the general focus behavior.

Parameters:
nextFocusLeft - the Component which will receive focus next when traversing with the left key
See Also:
getNextFocusLeft()

getNextFocusRight

public Component getNextFocusRight()
Allows us to determine which component will receive focus next when traversing with the right key.

Returns:
the Component will receive focus next when traversing with the right key
See Also:
setNextFocusRight(com.sun.dtv.lwuit.Component)

setNextFocusRight

public void setNextFocusRight(Component nextFocusRight)
Allows us to determine which component will receive focus next when traversing with the right key.

Parameters:
nextFocusRight - the Component which will receive focus next when traversing with the right key
See Also:
getNextFocusRight()

isEnabled

public boolean isEnabled()
Indicates whether component is enabled or disabled thus allowing us to prevent a component from receiving input events and indicate so visually.

Returns:
true if this Component is enabled, false otherwise

setEnabled

public void setEnabled(boolean enabled)
Indicates whether component is enabled or disabled thus allowing us to prevent a component from receiving input events and indicate so visually.

Parameters:
enabled - boolean to indicated whether the component should be enables or not

start

public void start()
Starts an animation. Please consider that an animation is in the stopped mode per default, so it has to be started explicitly once it has been created. In case the animation is already running, a call to start() causes a restart of the animation.

Specified by:
start in interface Animated

stop

public void stop()
Stops an animation. In case the animation is already stopped, the call to stop() has no effect.

Specified by:
stop in interface Animated

isRunning

public boolean isRunning()
Obtains the running mode of an animation. Returns true if the animation is running, false otherwise.

Specified by:
isRunning in interface Animated
Returns:
true if the animation is running, false otherwise

jumpTo

public void jumpTo(int position)
Forces an animation to jump to the position indicated by the parameter. An animation can be considered as a row of images, the parameter of this method provides the index within this row. If the animation is stopped, a call to this method causes the animation to show the image at the indicated position, but not to start. If the animation is running, a call to this method causes the animation to jump to the image at the indicated position and continue running immediately.

Specified by:
jumpTo in interface Animated
Parameters:
position - the index in the row of images building the animation to which the animation is forced to jump

getPosition

public int getPosition()
Obtains the current position the animation is at the point of time of th method call. An animation can be considered as a row of images, this method provides the index within this row.

Specified by:
getPosition in interface Animated
Returns:
the current position of the image within the row of images building this animation

setRepetitionMode

public void setRepetitionMode(int n)
Determines how often the animation is repeated once it has been started.

Specified by:
setRepetitionMode in interface Animated
Parameters:
n - number of repetitions to be determined. This can be any number larger than zero or LOOP alternatively. LOOP means that the animation runs in an endless loop until the stop() method has been called.
See Also:
getRepetitionMode()

getRepetitionMode

public int getRepetitionMode()
Returns the repetition mode of this animation in form of a number. The number reads how many repetitions have been determined for this animation.

Specified by:
getRepetitionMode in interface Animated
Returns:
number of repetitions determined for this animation or LOOP which means the animation runs in an endless loop until the stop() method has been called.
See Also:
setRepetitionMode(int)

setDelay

public void setDelay(int n)
Determines the delay after every image when running this animation.

Specified by:
setDelay in interface Animated
Parameters:
n - delay in milliseconds
See Also:
getDelay()

getDelay

public int getDelay()
Obtains the delay after every image for this animation when running.

Specified by:
getDelay in interface Animated
Returns:
the delay in milliseconds
See Also:
setDelay(int)

setAnimationMode

public void setAnimationMode(int mode)
Sets the animation mode for this animation. The animation mode determines how the animation is running: always forwards, or forwards and backwards alternating.

Specified by:
setAnimationMode in interface Animated
Parameters:
mode - the animation mode. Possible values are: REPEATING and ALTERNATING.
See Also:
getAnimationMode()

getAnimationMode

public int getAnimationMode()
Obtains the animation mode for this animation. The animation mode determines how the animation is running: always forwards, or forwards and backwards alternating.

Specified by:
getAnimationMode in interface Animated
Returns:
the animation mode. Possible values are: REPEATING and ALTERNATING.
See Also:
setAnimationMode(int)

initialize

protected void initialize()
Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state


deinitialize

protected void deinitialize()
Invoked to indicate that the component initialization is being reversed since the component was detached from the container hierarchy. This allows the component to deregister animators and cleanup after itself. This method is the opposite of the initialize method.


setInitialized

protected void setInitialized(boolean initialized)
Needed to support the concept of initialization. See initialize method for details.

Parameters:
initialized - initialization state to be set

isInitialized

protected boolean isInitialized()
Indicates if the component is in the initialized state, a component is initialized when its initialize method has been invoked. This method has to be invoked before showing the component to the user.

Returns:
true if the component is in the initialized state

getUIID

public String getUIID()
Retrieves unique identifier for a component, must be overriden for a component so a style can be applied to the component

Returns:
unique string identifying this component for the style sheet

setUIID

public void setUIID(String uiid)
Sets unique identifier for a component, as it is retrieved using getUIID.

Parameters:
uiid - the uiid to be set

scrollRectToVisible

protected void scrollRectToVisible(Rectangle rect,
                                   Component coordinateSpace)
Makes sure the component is visible in the scroll if this container is scrollable

Parameters:
rect - the rectangle that need to be visible
coordinateSpace - the component according to whose coordinates rect is defined. Rect's x/y are relative to that component (they are not absolute).

setScrollX

protected void setScrollX(int scrollX)
Indicates the X position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the x position of the component.

Parameters:
scrollX - the X position of the scrolling

setScrollY

protected void setScrollY(int scrollY)
Indicates the Y position of the scrolling, this number is relative to the component position and so a position of 0 would indicate the y position of the component.

Parameters:
scrollY - the Y position of the scrolling

setShouldCalcPreferredSize

protected void setShouldCalcPreferredSize(boolean shouldCalcPreferredSize)
Indicates the values within the component have changed and preferred size should be recalculated

Parameters:
shouldCalcPreferredSize - indicate whether this component need to recalculate its preferred size

Java DTV API 1.3
18-Nov-2009

Copyright © 2008-2009 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved.

U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. Sun, Sun Microsystems, the Sun logo and Java are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries.Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited.

DOCUMENTATION IS PROVIDED AS IS AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID.

Use of this document is subject to license terms.