Skip to main content


com.sun.lwuit
Class Component

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

public class Component
extends java.lang.Object
implements Animation, 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 Display).


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.
 
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.
protected  Dimension calcScrollSize()
          Method that can be overriden to represent the actual size of the component when it differs from the desireable size for the viewport
 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.
protected  void deinitializeCustomStyle(Style s)
          Allows components to create a style of their own, this method cleans up state for the given style
protected  void dragEnter(Component dragged)
          This callback method indicates that a component drag has just entered this component
protected  void dragExit(Component dragged)
          This callback method provides an indication for a drop target that a drag operation is exiting the bounds of this component and it should clear all relevant state if such state exists.
protected  boolean draggingOver(Component dragged, int x, int y)
          This method allows a component to indicate if it is a drop target for the given component at the given x/y location (in component coordiate space).
protected  void dragInitiated()
          Invoked on the focus component to let it know that drag has started on the parent container for the case of a component that doesn't support scrolling
protected  void drawDraggedImage(Graphics g, Image img, int x, int y)
          Draws the given image at x/y, this method can be overriden to draw additional information such as positive or negative drop indication
 void drop(Component dragged, int x, int y)
          Performs a drop operation of the component at the given X/Y location in coordinate space, this method should be overriden by subclasses to perform all of the logic related to moving a component, by default this method does nothing and so dragging a component and dropping it has no effect
protected  void fireClicked()
          When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly.
protected  void focusGained()
          Callback allowing a developer to track wheh the component gains focus
protected  void focusLost()
          Callback allowing a developer to track wheh the component loses focus
 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 getX()
 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.
protected  Border getBorder()
          Normally returns getStyle().getBorder() but some subclasses might use this to programmatically replace the border in runtime e.g.
 int getBottomGap()
          Returns the gap to be left for the bottom scrollbar on the X axis.
protected  Rectangle getBounds()
          Returns the component bounds which is sometimes more convenient than invoking getX/Y/Width/Height.
 java.lang.Object getClientProperty(java.lang.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 yet to a form
 Rectangle getDirtyRegion()
          gets the Component dirty region, this method is for internal use only and SHOULD NOT be invoked by user code.
 Style getDisabledStyle()
          Returns the Component Style for the disabled state allowing us to manipulate the look of the component when its disabled
protected  Image getDragImage()
          This method returns an image representing the dragged component, it can be overriden by subclasses to customize the look of the image, the image will be overlayed on top of the form during a drag and drop operation
protected  int getGridPosX()
          This method should be implemented correctly by subclasses to make snap to grid functionality work as expected.
protected  int getGridPosY()
          This method should be implemented correctly by subclasses to make snap to grid functionality work as expected.
 int getHeight()
          Returns the component height
 Label getLabelForComponent()
          Allows us to indicate the label associated with this component thus providing visual feedback related for this component e.g.
 java.lang.String getName()
          A component name allows us to easily identify the component within a dynamic UI.
 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 getPreferredH()
          Helper method to retrieve the preferred height of the component.
 Dimension getPreferredSize()
          Returns the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size.
 int getPreferredW()
          Helper method to retrieve the preferred width of the component.
 Style getPressedStyle()
          Returns the Component Style for the pressed state allowing us to manipulate the look of the component when it is pressed
 java.lang.String[] getPropertyNames()
          A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code
 java.lang.Class[] getPropertyTypes()
          Matches the property names method (see that method for further details).
 java.lang.Object getPropertyValue(java.lang.String name)
          Returns the current value of the property name, this method is used by the GUI builder
 int getScrollAnimationSpeed()
          Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode
 Dimension getScrollDimension()
          Returns the Components dimension in scrolling, this is very similar to the preferred size aspect only it represents actual scrolling limits.
 int getScrollOpacity()
          This method is used internally by the look and feel to implement the fading scrollbar behavior.
 int getScrollOpacityChangeSpeed()
          Indicates the decrement units for the scroll opacity
 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.
 java.lang.String getSelectCommandText()
          Allows determining the text for the select command used in the 3rd softbutton mode.
 Rectangle getSelectedRect()
          Returns the component bounds with absolute screen coordinates, for components that include an internal selection behavior and are not containers (currently only List) this method allows returning the position of the selection itself which is useful for things such as the popup dialog and similar UI's that need to reference the position of the selection externally
 Style getSelectedStyle()
          Returns the Component Style for the selected state allowing us to manipulate the look of the component when it owns focus
 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
 int getTensileLength()
          Recommended length for the tensile, -1 for default
 java.lang.String getUIID()
          Unique identifier for a component.
 Style getUnselectedStyle()
          Returns the Component Style for the unselected mode allowing us to manipulate the look of the component
protected  Rectangle getVisibleBounds()
          Returns the component bounds for scrolling which might differ from the getBounds for large components e.g.
 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
 void growShrink(int duration)
          Grows or shrinks this component to its new preferred size, this method essentially takes a component whose preferred size has changed and creates a "growing" effect that lasts for the duration.
 boolean handlesInput()
          Prevents key events from being grabbed for focus traversal.
 boolean hasFocus()
          Returns true if the component has focus
protected  void initComponent()
          Allows subclasses to bind functionality that relies on fully initialized and "ready for action" component state
protected  void initCustomStyle(Style s)
          Allows components to create a style of their own, this method binds the listener to the style and installs a bg painter
protected  void installDefaultPainter(Style s)
          Allows subclasses to create their own custom style types and install the background painter into them
 boolean isAlwaysTensile()
          Enable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)
protected  boolean isDragActivated()
          Indicates whether we are in the middle of a drag operation, this method allows developers overriding the pointer released events to know when this is a drag operaton.
protected  boolean isDragAndDropOperation(int x, int y)
          This method allows a developer to define only a specific portion of a component as draggable by default it returns true if the component is defined as "draggable"
 boolean isDraggable()
          Indicates whether this component can be dragged in a drag and drop operation rather than scroll the parent
 boolean isDropTarget()
          Indicates whether this component can receive dropped components into it, notice that when dropping on a component or container the parents will be checked recursively to find a valid drop target
 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 isFlatten()
          Makes the component effectively opaque by blending the backgrounds into an image in memory so the layer of underlying components is only drawn once when this component is repainted.
 boolean isFocusable()
          Returns true if this component can receive focus and is enabled
 boolean isGrabsPointerEvents()
          This property is useful for blocking in z-order touch events, sometimes we might want to grab touch events in a specific component without making it focusable.
 boolean isHideInPortrait()
          Indicates that this component and all its children should be hidden when the device is switched to portrait mode
protected  boolean isInitialized()
          Indicates if the component is in the initialized state, a component is initialized when its initComponent() method was invoked.
 boolean isRTL()
          Is the component a bidi RTL component
protected  boolean isScrollable()
          Indicates whether the component should/could scroll by default a component is not scrollable.
 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
protected  boolean isSelectableInteraction()
          This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.
 boolean isSmoothScrolling()
          Indicates that scrolling through the component should work as an animation
 boolean isSnapToGrid()
          Indicates whether scrolling this component should jump to a specific location in a grid
 boolean isTactileTouch()
          Indicates whether the component should "trigger" tactile touch when pressed by the user in a touch screen UI.
protected  boolean isTactileTouch(int x, int y)
          Elaborate components might not provide tactile feedback for all their areas (e.g.
 boolean isTensileDragEnabled()
          Indicates whether tensile drag (dragging beyond the boundry of the component and snapping back) is enabled for this component.
 boolean isVisible()
          Returns whether the component is visible or not
 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.
protected  void laidOut()
          This is a callback method to inform the Component when it's been laidout on the parent Container
protected  void longKeyPress(int keyCode)
          If this Component is focused this method is invoked when the user presses and holds the key
protected  void longPointerPress(int x, int y)
          If this Component is focused this method is invoked when the user presses and holds the pointer on the Component
 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.
protected  void paintBackground(Graphics g)
          Paints the background of the component, invoked with the clipping region and appropriate scroll translation.
 void paintBackgrounds(Graphics g)
          This method paints all the parents Components Background.
protected  void paintBorder(Graphics g)
          Draws the component border if such a border exists.
 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.
 Image paintLock(boolean hardLock)
          This method locks the component so it will always paint the given image instead of running through its paint logic.
 void paintLockRelease()
          Releases the paint lock image to allow paint to work as usual, see paintLock(boolean) for details
protected  void paintScrollbars(Graphics g)
          Paints the UI for the scrollbars on the component, this will be invoked only for scrollable components.
protected  void paintScrollbarX(Graphics g)
          Paints the UI for the scrollbar on the X axis, this method allows component subclasses to customize the look of a scrollbar
protected  void paintScrollbarY(Graphics g)
          Paints the UI for the scrollbar on the Y axis, this method allows component subclasses to customize the look of a scrollbar
protected  java.lang.String paramString()
          Returns a string representing the state of this component.
 void pointerDragged(int[] x, int[] y)
          If this Component is focused, the pointer dragged event will call this method
 void pointerDragged(int x, int y)
          If this Component is focused, the pointer dragged event will call this method
 void pointerHover(int[] x, int[] y)
          Invoked for devices where the pointer can hover without actually clicking the display.
 void pointerHoverPressed(int[] x, int[] y)
          Invoked for devices where the pointer can hover without actually clicking the display.
 void pointerHoverReleased(int[] x, int[] y)
          Invoked for devices where the pointer can hover without actually clicking the display.
 void pointerPressed(int[] x, int[] y)
          If this Component is focused, the pointer pressed 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 pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method
 void putClientProperty(java.lang.String key, java.lang.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
protected  void refreshTheme(java.lang.String id)
          Makes sure the component is up to date with the given UIID
 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)
          Repaints a specific region within the component
 void requestFocus()
          Changes the current component to the focused component, will work only for a component that belongs to a parent form.
 void scrollRectToVisible(int x, int y, int width, int height, Component coordinateSpace)
          Makes sure the component is visible in the scroll if this container is scrollable
protected  void scrollRectToVisible(Rectangle rect, Component coordinateSpace)
          Makes sure the component is visible in the scroll if this container is scrollable
 void setAlwaysTensile(boolean alwaysTensile)
          Enable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)
 void setCellRenderer(boolean cellRenderer)
          Used as an optimization to mark that this component is currently being used as a cell renderer
 void setDirtyRegion(Rectangle dirty)
          sets the Component dirty region, this method is for internal use only and SHOULD NOT be invoked by user code.
 void setDisabledStyle(Style style)
          Changes the Component disalbed Style by replacing the Component Style with the given Style
 void setDraggable(boolean draggable)
          Indicates whether this component can be dragged in a drag and drop operation rather than scroll the parent
 void setDropTarget(boolean dropTarget)
          Indicates whether this component can receive dropped components into it, notice that when dropping on a component or container the parents will be checked recursively to find a valid drop target
 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 setFlatten(boolean flatten)
          Makes the component effectively opaque by blending the backgrounds into an image in memory so the layer of underlying components is only drawn once when this component is repainted.
 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 setGrabsPointerEvents(boolean grabsPointerEvents)
          This property is useful for blocking in z-order touch events, sometimes we might want to grab touch events in a specific component without making it focusable.
 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.
If a user wishes to effect the component size setPreferredSize should be used.
 void setHideInPortrait(boolean hideInPortrait)
          Indicates that this component and all its children should be hidden when the device is switched to portrait mode
protected  void setInitialized(boolean initialized)
          Indicates if the component is in the initialized state, a component is initialized when its initComponent() method was invoked.
 void setIsScrollVisible(boolean isScrollVisible)
          Deprecated. replaced by setScrollVisible to match the JavaBeans spec
 void setLabelForComponent(Label componentLabel)
          Allows us to indicate the label associated with this component thus providing visual feedback related for this component e.g.
 void setName(java.lang.String name)
          A component name allows us to easily identify the component within a dynamic UI.
 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 setPreferredH(int preferredH)
          Helper method to set the preferred height of the component.
 void setPreferredSize(Dimension d)
          Sets the Component Preferred Size, there is no guarantee the Component will be sized at its Preferred Size.
 void setPreferredW(int preferredW)
          Helper method to set the preferred width of the component.
 void setPressedStyle(Style style)
          Sets the Component Style for the pressed state allowing us to manipulate the look of the component when it is pressed
 java.lang.String setPropertyValue(java.lang.String name, java.lang.Object value)
          Sets a new value to the given property, returns an error message if failed and null if successful.
 void setRTL(boolean rtl)
          Is the component a bidi RTL component
 void setScrollAnimationSpeed(int animationSpeed)
          Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode
 void setScrollOpacityChangeSpeed(int scrollOpacityChangeSpeed)
          Indicates the decrement units for the scroll opacity
 void setScrollSize(Dimension d)
          Set the size for the scroll area
 void setScrollVisible(boolean isScrollVisible)
          Set whether this component scroll is visible
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 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.
 void setSelectCommandText(java.lang.String selectText)
          Allows determining the text for the select command used in the 3rd softbutton mode.
 void setSelectedStyle(Style style)
          Changes the Component selected Style by replacing the Component Style with the given Style
 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.
If a user wishes to effect the component size setPreferredSize should be used.
 void setSmoothScrolling(boolean smoothScrolling)
          Indicates that scrolling through the component should work as an animation
 void setSnapToGrid(boolean snapToGrid)
          Indicates whether scrolling this component should jump to a specific location in a grid
 void setTactileTouch(boolean tactileTouch)
          Indicates whether the component should "trigger" tactile touch when pressed by the user in a touch screen UI.
 void setTensileDragEnabled(boolean tensileDragEnabled)
          Indicates whether tensile drag (dragging beyond the boundry of the component and snapping back) is enabled for this component.
 void setTensileLength(int tensileLength)
          Recommended length for the tensile, -1 for default
 void setUIID(java.lang.String id)
          This method sets the Component the Unique identifier.
 void setUnselectedStyle(Style style)
          Changes the Component Style by replacing the Component Style with the given Style
 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.
If a user wishes to effect the component size setPreferredSize should be used.
 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 styleChanged(java.lang.String propertyName, Style source)
          Invoked to indicate a change in a propertyName of a Style
 java.lang.String toString()
          Overriden to return a useful value for debugging purposes
 
Methods inherited from class java.lang.Object
equals, 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

getY

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

Returns:
the current y coordinate of the components origin

isVisible

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

Returns:
true if component is visible; otherwise false

getClientProperty

public java.lang.Object getClientProperty(java.lang.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(java.lang.String key,
                              java.lang.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

getDirtyRegion

public final Rectangle getDirtyRegion()
gets the Component dirty region, this method is for internal use only and SHOULD NOT be invoked by user code. Use repaint(int,int,int,int)

Returns:
returns the region that needs repainting or null for the whole component

setDirtyRegion

public final void setDirtyRegion(Rectangle dirty)
sets the Component dirty region, this method is for internal use only and SHOULD NOT be invoked by user code. Use repaint(int,int,int,int)

Parameters:
dirty - the region that needs repainting or null for the whole component

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

getHeight

public int getHeight()
Returns the component height

Returns:
the component height

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

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

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

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

getScrollDimension

public Dimension getScrollDimension()
Returns the Components dimension in scrolling, this is very similar to the preferred size aspect only it represents actual scrolling limits.

Returns:
the component actual size with all scrolling

calcScrollSize

protected Dimension calcScrollSize()
Method that can be overriden to represent the actual size of the component when it differs from the desireable size for the viewport

Returns:
scroll size, by default this is the same as the preferred size

setScrollSize

public void setScrollSize(Dimension d)
Set the size for the scroll area

Parameters:
d - dimension of the scroll area

setPreferredW

public void setPreferredW(int preferredW)
Helper method to set the preferred width of the component.

Parameters:
preferredW - the preferred width of the component
See Also:
setPreferredSize(com.sun.lwuit.geom.Dimension)

setPreferredH

public void setPreferredH(int preferredH)
Helper method to set the preferred height of the component.

Parameters:
preferredH - the preferred height of the component
See Also:
setPreferredSize(com.sun.lwuit.geom.Dimension)

getPreferredW

public int getPreferredW()
Helper method to retrieve the preferred width of the component.

Returns:
preferred width of the component
See Also:
getPreferredSize()

getPreferredH

public int getPreferredH()
Helper method to retrieve the preferred height of the component.

Returns:
preferred height of the component
See Also:
getPreferredSize()

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:
setPreferredSize(com.sun.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:
setPreferredSize(com.sun.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.lwuit.geom.Dimension)

getUIID

public java.lang.String getUIID()
Unique identifier for a component. This id is used to retrieve a suitable Style.

Returns:
unique string identifying this component for the style sheet

setUIID

public void setUIID(java.lang.String id)
This method sets the Component the Unique identifier. This method should be used before a component has been initialized

Parameters:
id - UIID unique identifier for component type

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

removeFocusListener

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

Parameters:
l - listener interface implementing the observable pattern

fireClicked

protected void fireClicked()
When working in 3 softbutton mode "fire" key (center softbutton) is sent to this method in order to allow 3 button devices to work properly. When overriding this method you should also override isSelectableInteraction to indicate that a command is placed appropriately on top of the fire key for 3 soft button phones.


isSelectableInteraction

protected boolean isSelectableInteraction()
This method allows a component to indicate that it is interested in an "implicit" select command to appear in the "fire" button when 3 softbuttons are defined in a device.

Returns:
true if this is a selectable interaction

setSelectCommandText

public void setSelectCommandText(java.lang.String selectText)
Allows determining the text for the select command used in the 3rd softbutton mode.

Parameters:
selectText - text for the interaction with the softkey

getSelectCommandText

public java.lang.String getSelectCommandText()
Allows determining the text for the select command used in the 3rd softbutton mode.

Returns:
text for the interaction with the softkey

setLabelForComponent

public void setLabelForComponent(Label componentLabel)
Allows us to indicate the label associated with this component thus providing visual feedback related for this component e.g. starting the ticker when the component receives focus.

Parameters:
componentLabel - a label associated with this component

getLabelForComponent

public Label getLabelForComponent()
Allows us to indicate the label associated with this component thus providing visual feedback related for this component e.g. starting the ticker when the component receives focus.

Returns:
the label associated with this component

focusGained

protected void focusGained()
Callback allowing a developer to track wheh the component gains focus


focusLost

protected void focusLost()
Callback allowing a developer to track wheh the component loses focus


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 getX()

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

paintScrollbars

protected void paintScrollbars(Graphics g)
Paints the UI for the scrollbars on the component, this will be invoked only for scrollable components. This method invokes the appropriate X/Y versions to do all the work.

Parameters:
g - the component graphics

paintScrollbarX

protected void paintScrollbarX(Graphics g)
Paints the UI for the scrollbar on the X axis, this method allows component subclasses to customize the look of a scrollbar

Parameters:
g - the component graphics

getScrollOpacity

public int getScrollOpacity()
This method is used internally by the look and feel to implement the fading scrollbar behavior.

Returns:
the opacity of the scrollbar

getSelectedRect

public Rectangle getSelectedRect()
Returns the component bounds with absolute screen coordinates, for components that include an internal selection behavior and are not containers (currently only List) this method allows returning the position of the selection itself which is useful for things such as the popup dialog and similar UI's that need to reference the position of the selection externally

Returns:
the bounds of the component with absolute screen coordinates

paintScrollbarY

protected void paintScrollbarY(Graphics g)
Paints the UI for the scrollbar on the Y axis, this method allows component subclasses to customize the look of a scrollbar

Parameters:
g - the component graphics

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

getBorder

protected Border getBorder()
Normally returns getStyle().getBorder() but some subclasses might use this to programmatically replace the border in runtime e.g. for a pressed border effect

Returns:
the border that is drawn according to the current component state

paintBackground

protected void paintBackground(Graphics g)
Paints the background of the component, invoked with the clipping region and appropriate scroll translation.

Parameters:
g - the component graphics

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

isScrollable

protected boolean isScrollable()
Indicates whether the component should/could scroll by default a component is not scrollable.

Returns:
whether the component is scrollable

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

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 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:
scrollY - 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

calcPreferredSize

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

Returns:
the calculated preferred size based on component content

getBounds

protected 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()

getVisibleBounds

protected Rectangle getVisibleBounds()
Returns the component bounds for scrolling which might differ from the getBounds for large components e.g. list.

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

setShouldCalcPreferredSize

public 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 his preferred size

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 form

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 yet 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.

See Also:
Display

repaint

public void repaint(int x,
                    int y,
                    int w,
                    int h)
Repaints a specific region within the component

Parameters:
x - boundry of the region to repaint
y - boundry of the region to repaint
w - boundry of the region to repaint
h - boundry of the region to repaint

longKeyPress

protected 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.

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

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

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

pointerHover

public void pointerHover(int[] x,
                         int[] y)
Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.

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

pointerHoverReleased

public void pointerHoverReleased(int[] x,
                                 int[] y)
Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.

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

pointerHoverPressed

public void pointerHoverPressed(int[] x,
                                int[] y)
Invoked for devices where the pointer can hover without actually clicking the display. This is true for PC mouse pointer as well as some devices such as the BB storm.

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

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

getDragImage

protected Image getDragImage()
This method returns an image representing the dragged component, it can be overriden by subclasses to customize the look of the image, the image will be overlayed on top of the form during a drag and drop operation

Returns:
an image

dragInitiated

protected void dragInitiated()
Invoked on the focus component to let it know that drag has started on the parent container for the case of a component that doesn't support scrolling


drawDraggedImage

protected void drawDraggedImage(Graphics g,
                                Image img,
                                int x,
                                int y)
Draws the given image at x/y, this method can be overriden to draw additional information such as positive or negative drop indication

Parameters:
g - the graphics context
img - the image
x - x position
y - y position

draggingOver

protected boolean draggingOver(Component dragged,
                               int x,
                               int y)
This method allows a component to indicate if it is a drop target for the given component at the given x/y location (in component coordiate space). This method can also update the drop tagets appearance to indicate the drop location.

Parameters:
dragged - the component being dragged
x - the x location over the component
y - the y location over the component
Returns:
true if a drop at this location will be successful

dragEnter

protected void dragEnter(Component dragged)
This callback method indicates that a component drag has just entered this component

Parameters:
dragged - the component being dragged

dragExit

protected void dragExit(Component dragged)
This callback method provides an indication for a drop target that a drag operation is exiting the bounds of this component and it should clear all relevant state if such state exists. E.g. if a component provides drop indication visuaization in draggingOver this visualization should be cleared..

Parameters:
dragged - the component being dragged

drop

public void drop(Component dragged,
                 int x,
                 int y)
Performs a drop operation of the component at the given X/Y location in coordinate space, this method should be overriden by subclasses to perform all of the logic related to moving a component, by default this method does nothing and so dragging a component and dropping it has no effect

Parameters:
dragged - the component being dropped
x - the x coordinate of the drop
y - the y coordinate of the drop

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

isDragAndDropOperation

protected boolean isDragAndDropOperation(int x,
                                         int y)
This method allows a developer to define only a specific portion of a component as draggable by default it returns true if the component is defined as "draggable"

Parameters:
x - the x coordinate relative to the component
y - the y coordinate relative to the component
Returns:
true if a press in this point might indicate the desire to begin a drag operation

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

longPointerPress

protected void longPointerPress(int x,
                                int y)
If this Component is focused this method is invoked when the user presses and holds the pointer on the Component


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

setTensileDragEnabled

public void setTensileDragEnabled(boolean tensileDragEnabled)
Indicates whether tensile drag (dragging beyond the boundry of the component and snapping back) is enabled for this component.

Parameters:
tensileDragEnabled - true to enable tensile drag

isTensileDragEnabled

public boolean isTensileDragEnabled()
Indicates whether tensile drag (dragging beyond the boundry of the component and snapping back) is enabled for this component.

Returns:
true when tensile drag is enabled

getStyle

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

Returns:
the component Style object

getPressedStyle

public Style getPressedStyle()
Returns the Component Style for the pressed state allowing us to manipulate the look of the component when it is pressed

Returns:
the component Style object

setPressedStyle

public void setPressedStyle(Style style)
Sets the Component Style for the pressed state allowing us to manipulate the look of the component when it is pressed

Parameters:
style - the component Style object

getUnselectedStyle

public Style getUnselectedStyle()
Returns the Component Style for the unselected mode allowing us to manipulate the look of the component

Returns:
the component Style object

getSelectedStyle

public Style getSelectedStyle()
Returns the Component Style for the selected state allowing us to manipulate the look of the component when it owns focus

Returns:
the component Style object

getDisabledStyle

public Style getDisabledStyle()
Returns the Component Style for the disabled state allowing us to manipulate the look of the component when its disabled

Returns:
the component Style object

setUnselectedStyle

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

Parameters:
style - the component Style object

setSelectedStyle

public void setSelectedStyle(Style style)
Changes the Component selected Style by replacing the Component Style with the given Style

Parameters:
style - the component Style object

setDisabledStyle

public void setDisabledStyle(Style style)
Changes the Component disalbed Style by replacing the Component Style with the given Style

Parameters:
style - the component Style object

installDefaultPainter

protected void installDefaultPainter(Style s)
Allows subclasses to create their own custom style types and install the background painter into them

Parameters:
s - the custom style

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 java.lang.String toString()
Overriden to return a useful value for debugging purposes

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

paramString

protected java.lang.String paramString()
Returns a string representing the state of this component. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.

Returns:
a string representation of this component's state

refreshTheme

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


refreshTheme

protected void refreshTheme(java.lang.String id)
Makes sure the component is up to date with the given UIID

Parameters:
id - The Style Id to update the Component with

isDragActivated

protected boolean isDragActivated()
Indicates whether we are in the middle of a drag operation, this method allows developers overriding the pointer released events to know when this is a drag operaton.

Returns:
true if we are in the middle of a drag; otherwise false

getGridPosY

protected int getGridPosY()
This method should be implemented correctly by subclasses to make snap to grid functionality work as expected. Returns the ideal grid Y position closest to the current Y position.

Returns:
a valid Y position in the grid

getGridPosX

protected int getGridPosX()
This method should be implemented correctly by subclasses to make snap to grid functionality work as expected. Returns the ideal grid X position closest to the current X position.

Returns:
a valid Y position in the grid

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. Frames are defined by the Display class.

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

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).

scrollRectToVisible

public void scrollRectToVisible(int x,
                                int y,
                                int width,
                                int height,
                                Component coordinateSpace)
Makes sure the component is visible in the scroll if this container is scrollable

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

paintBorder

protected void paintBorder(Graphics g)
Draws the component border if such a border exists. The border unlike the content of the component will not be affected by scrolling for a scrollable component.

Parameters:
g - graphics context on which the border is painted

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

setScrollVisible

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

Parameters:
isScrollVisible - Indicate whether this component scroll is visible

setIsScrollVisible

public void setIsScrollVisible(boolean isScrollVisible)
Deprecated. replaced by setScrollVisible to match the JavaBeans spec

Set whether this component scroll is visible

Parameters:
isScrollVisible - Indicate whether this component scroll is visible

laidOut

protected void laidOut()
This is a callback method to inform the Component when it's been laidout on the parent Container


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 initComponent() method.


initComponent

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


isInitialized

protected boolean isInitialized()
Indicates if the component is in the initialized state, a component is initialized when its initComponent() method was invoked. The initMethod is invoked before showing the component to the user.

Returns:
true if the component is in the initialized state

setInitialized

protected void setInitialized(boolean initialized)
Indicates if the component is in the initialized state, a component is initialized when its initComponent() method was invoked. The initMethod is invoked before showing the component to the user.

Parameters:
initialized - Indicates if the component is in the initialized state

styleChanged

public void styleChanged(java.lang.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 next focus 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 next focus component

getNextFocusUp

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

Returns:
the nxt focus 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 - next focus component

getNextFocusLeft

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

Returns:
the next focus 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 next focus component

getNextFocusRight

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

Returns:
the next focus 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 next focus component

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 enabled

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 - true to enable false to disable

getName

public java.lang.String getName()
A component name allows us to easily identify the component within a dynamic UI.

Returns:
name of the component

setName

public void setName(java.lang.String name)
A component name allows us to easily identify the component within a dynamic UI.

Parameters:
name - a name for the component

initCustomStyle

protected void initCustomStyle(Style s)
Allows components to create a style of their own, this method binds the listener to the style and installs a bg painter

Parameters:
s - style to initialize

deinitializeCustomStyle

protected void deinitializeCustomStyle(Style s)
Allows components to create a style of their own, this method cleans up state for the given style

Parameters:
s - style no longer used

isRTL

public boolean isRTL()
Is the component a bidi RTL component

Returns:
true if the component is working in a right to left mode

setRTL

public void setRTL(boolean rtl)
Is the component a bidi RTL component

Parameters:
rtl - true if the component should work in a right to left mode

isTactileTouch

protected boolean isTactileTouch(int x,
                                 int y)
Elaborate components might not provide tactile feedback for all their areas (e.g. Lists) this method defaults to returning the value of isTactileTouch

Parameters:
x - the x position
y - the y position
Returns:
True if the device should vibrate

isTactileTouch

public boolean isTactileTouch()
Indicates whether the component should "trigger" tactile touch when pressed by the user in a touch screen UI.

Returns:
the tactileTouch

setTactileTouch

public void setTactileTouch(boolean tactileTouch)
Indicates whether the component should "trigger" tactile touch when pressed by the user in a touch screen UI.

Parameters:
tactileTouch - true to trigger vibration when the component is pressed

getPropertyNames

public java.lang.String[] getPropertyNames()
A component may expose mutable property names for a UI designer to manipulate, this API is designed for usage internally by the GUI builder code

Returns:
the property names allowing mutation

getPropertyTypes

public java.lang.Class[] getPropertyTypes()
Matches the property names method (see that method for further details).

Returns:
the types of the properties

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Returns the current value of the property name, this method is used by the GUI builder

Parameters:
name - the name of the property
Returns:
the value of said property

setPropertyValue

public java.lang.String setPropertyValue(java.lang.String name,
                                         java.lang.Object value)
Sets a new value to the given property, returns an error message if failed and null if successful. Notice that some builtin properties such as "$designMode" might be sent to components to indicate application state.

Parameters:
name - the name of the property
value - new value for the property
Returns:
error message or null

paintLockRelease

public void paintLockRelease()
Releases the paint lock image to allow paint to work as usual, see paintLock(boolean) for details


paintLock

public Image paintLock(boolean hardLock)
This method locks the component so it will always paint the given image instead of running through its paint logic. This is useful when running transitions that might be quite expensive on the device. A lock should be released using paintLockRelease(), it is implicitly released when a component is deinitialized although a component doesn't need to be initialized to be locked!
If the component is not opaque null is always returned!

Duplicate calls to this method won't produce duplicate locks, in case of a soft lock the return value will always be null.

Parameters:
hardLock - indicates whether the lock uses a hard or a soft reference to the image
Returns:
the image in case of a hard lock

isSnapToGrid

public boolean isSnapToGrid()
Indicates whether scrolling this component should jump to a specific location in a grid

Returns:
the snapToGrid

setSnapToGrid

public void setSnapToGrid(boolean snapToGrid)
Indicates whether scrolling this component should jump to a specific location in a grid

Parameters:
snapToGrid - the snapToGrid to set

isFlatten

public boolean isFlatten()
Makes the component effectively opaque by blending the backgrounds into an image in memory so the layer of underlying components is only drawn once when this component is repainted. This does have a significant memory overhead.

Returns:
the flatten property

setFlatten

public void setFlatten(boolean flatten)
Makes the component effectively opaque by blending the backgrounds into an image in memory so the layer of underlying components is only drawn once when this component is repainted. This does have a significant memory overhead.

Parameters:
flatten - the flatten value

getTensileLength

public int getTensileLength()
Recommended length for the tensile, -1 for default

Returns:
Recommended length for the tensile, -1 for default

setTensileLength

public void setTensileLength(int tensileLength)
Recommended length for the tensile, -1 for default

Parameters:
tensileLength - length for tensile drag

isGrabsPointerEvents

public boolean isGrabsPointerEvents()
This property is useful for blocking in z-order touch events, sometimes we might want to grab touch events in a specific component without making it focusable.

Returns:
the grabsPointerEvents

setGrabsPointerEvents

public void setGrabsPointerEvents(boolean grabsPointerEvents)
This property is useful for blocking in z-order touch events, sometimes we might want to grab touch events in a specific component without making it focusable.

Parameters:
grabsPointerEvents - the grabsPointerEvents to set

getScrollOpacityChangeSpeed

public int getScrollOpacityChangeSpeed()
Indicates the decrement units for the scroll opacity

Returns:
the scrollOpacityChangeSpeed

setScrollOpacityChangeSpeed

public void setScrollOpacityChangeSpeed(int scrollOpacityChangeSpeed)
Indicates the decrement units for the scroll opacity

Parameters:
scrollOpacityChangeSpeed - the scrollOpacityChangeSpeed to set

growShrink

public void growShrink(int duration)
Grows or shrinks this component to its new preferred size, this method essentially takes a component whose preferred size has changed and creates a "growing" effect that lasts for the duration. Notice that some components (such as text areas) don't report proper preferred size untill they are laid out once. Hence the first time around a text area (or container containing a text area) will not produce the expected effect. This can be solved by invoking revalidate before the call to this method only the first time around!

Parameters:
duration - the duration in milliseconds for the grow/shrink animation

isAlwaysTensile

public boolean isAlwaysTensile()
Enable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)

Returns:
the alwaysTensile

setAlwaysTensile

public void setAlwaysTensile(boolean alwaysTensile)
Enable the tensile drag to work even when a component doesn't have a scroll showable (scrollable flag still needs to be set to true)

Parameters:
alwaysTensile - the alwaysTensile to set

isDraggable

public boolean isDraggable()
Indicates whether this component can be dragged in a drag and drop operation rather than scroll the parent

Returns:
the draggable state

setDraggable

public void setDraggable(boolean draggable)
Indicates whether this component can be dragged in a drag and drop operation rather than scroll the parent

Parameters:
draggable - the draggable to set

isDropTarget

public boolean isDropTarget()
Indicates whether this component can receive dropped components into it, notice that when dropping on a component or container the parents will be checked recursively to find a valid drop target

Returns:
the dropTarget state

setDropTarget

public void setDropTarget(boolean dropTarget)
Indicates whether this component can receive dropped components into it, notice that when dropping on a component or container the parents will be checked recursively to find a valid drop target

Parameters:
dropTarget - the dropTarget to set

isHideInPortrait

public boolean isHideInPortrait()
Indicates that this component and all its children should be hidden when the device is switched to portrait mode

Returns:
the hideInPortrait

setHideInPortrait

public void setHideInPortrait(boolean hideInPortrait)
Indicates that this component and all its children should be hidden when the device is switched to portrait mode

Parameters:
hideInPortrait - set to true in order to hide when in portrait


Copyright 2011 Oracle Corporation. All rights reserved. Use is subject to license terms.
 
 
Close
loading
Please Confirm
Close