Skip to main content


com.sun.lwuit
Class Form

java.lang.Object
  
extended by com.sun.lwuit.Component extended by com.sun.lwuit.Container extended by com.sun.lwuit.Form
All Implemented Interfaces:
Animation, StyleListener
Direct Known Subclasses:
Dialog

public class Form
extends Container

Top level component that serves as the root for the UI, this Container handles the menus and title while placing content between them. By default a forms central content (the content pane) is scrollable. Form contains Title bar, MenuBar and a ContentPane. Calling to addComponent on the Form is delegated to the contenPane.addComponent


       **************************
       *         Title          *
       **************************
       *                        *
       *                        *
       *      ContentPane       *
       *                        *
       *                        *
       **************************
       *         MenuBar        *
       **************************


Field Summary
protected  boolean focusScrolling
          Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of LWUIT.
 
Fields inherited from class com.sun.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Constructor Summary
Form()
          Default constructor creates a simple form
Form(java.lang.String title)
          Sets the title after invoking the constructor
 
Method Summary
protected  void actionCommand(Command cmd)
          Invoked to allow subclasses of form to handle a command from one point rather than implementing many command instances.
 void addCommand(Command cmd)
          Adds a command to the menu bar softkeys.
 void addCommand(Command cmd, int offset)
          Adds a command to the menu bar softkeys or into the menu dialog, this version of add allows us to place a command in an arbitrary location.
 void addCommandListener(ActionListener l)
          A listener that is invoked when a command is clicked allowing multiple commands to be handled by a single block
 void addComponent(Component cmp)
          Adds Component to the Form's Content Pane
 void addComponent(int index, Component cmp)
          Adds Component to the Form's Content Pane
 void addComponent(int index, java.lang.Object constraints, Component cmp)
          Adds a Component to the Container
 void addComponent(java.lang.Object constraints, Component cmp)
          Adds a Component to the Container
 void addGameKeyListener(int keyCode, ActionListener listener)
          Add a game key listener to the given gamekey for a callback when the key is released
 void addKeyListener(int keyCode, ActionListener listener)
          Add a key listener to the given keycode for a callback when the key is released
 void addOrientationListener(ActionListener l)
          This listener is invoked when device orientation changes on devices that support orientation change
 void addPointerDraggedListener(ActionListener l)
          Adds a listener to the pointer event
 void addPointerPressedListener(ActionListener l)
          Adds a listener to the pointer event
 void addPointerReleasedListener(ActionListener l)
          Adds a listener to the pointer event
 void addShowListener(ActionListener l)
          This listener would be invoked when show is completed
 boolean animate()
          Allows the animation to reduce "repaint" calls when it returns false.
 void deregisterAnimated(Animation cmp)
          Indicate that cmp would no longer like to receive animation events
 void dispatchCommand(Command cmd, ActionEvent ev)
          Dispatches a command via the standard form mechanism of firing a command event
 Component findNextFocusHorizontal(boolean right)
          This method returns the next focusable Component horizontally
 Component findNextFocusVertical(boolean down)
          This method returns the next focusable Component vertically
 Command getBackCommand()
          Indicates the command that is defined as the back command out of this form.
 Command getClearCommand()
          Indicates the command that is defined as the clear command in this form.
 Command getCommand(int index)
          Returns the command occupying the given index
 int getCommandCount()
          A helper method to check the amount of commands within the form menu
 Form getComponentForm()
          Returns the Component Form or null if this Component is not added yet to a form
 int getComponentIndex(Component cmp)
          Returns the Component index in the Container
 Container getContentPane()
          This method returns the Content pane instance
 Command getDefaultCommand()
          Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes.
 Component getFocused()
          Returns the current focus component for this form
 Painter getGlassPane()
          Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations.
 Layout getLayout()
          Returns the layout manager responsible for arranging this container
 MenuBar getMenuBar()
          Returns the associated Menu Bar object
 Style getMenuStyle()
          Returns the style of the menu
 int getScrollAnimationSpeed()
          Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode
 Button getSoftButton(int offset)
          Returns the button representing the softbutton, this allows modifying softbutton attributes and behavior programmatically rather than by using the command API.
 int getSoftButtonCount()
          Returns the number of buttons on the menu bar for use with getSoftButton()
 int getTintColor()
          Default color for the screen tint when a dialog or a menu is shown
 java.lang.String getTitle()
          Returns the Form title text
 Container getTitleArea()
          Title area manipulation might break with future changes to LWUIT and might damage themeing/functionality of the LWUIT application in some platforms
 Label getTitleComponent()
          Allows modifying the title attributes beyond style (e.g.
 Style getTitleStyle()
          Returns the style of the title
 Transition getTransitionInAnimator()
          This property allows us to define a an animation that will draw the transition for entering this form.
 Transition getTransitionOutAnimator()
          This property allows us to define a an animation that will draw the transition for exiting this form.
 boolean hasMedia()
          Used by the implementation to prevent flickering when flushing the double buffer
protected  void hideNotify()
          This method is only invoked when the underlying canvas for the form is hidden this method isn't called for form based events and is generally usable for suspend/resume based behavior
 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)
 boolean isCyclicFocus()
          Indicates whether focus should cycle within the form
 boolean isFocusScrolling()
          Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of LWUIT.
 boolean isSingleFocusMode()
          Returns true if there is only one focusable member in this form.
 boolean isSmoothScrolling()
          Indicates that scrolling through the component should work as an animation
 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 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
protected  void onShow()
          Allows subclasses to bind functionality that occurs when a specific form or dialog appears on the screen
protected  void onShowCompleted()
          Allows subclasses to bind functionality that occurs when a specific form or dialog is "really" showing hence when the transition is totally complete (unlike onShow which is called on intent).
 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 paintBackground(Graphics g)
          Exposing the background painting for the benefit of animations
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 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 pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method
 void refreshTheme()
          Makes sure the component is up to date with the current style object
 void registerAnimated(Animation cmp)
          The given component is interested in animating its appearance and will start receiving callbacks when it is visible in the form allowing it to animate its appearance.
 void removeAll()
          Removes all Components from the Content Pane
 void removeAllCommands()
          Clear menu commands from the menu bar
 void removeCommand(Command cmd)
          Removes the command from the menu bar softkeys
 void removeCommandListener(ActionListener l)
          A listener that is invoked when a command is clicked allowing multiple commands to be handled by a single block
 void removeComponent(Component cmp)
          Removes a component from the Form's Content Pane
 void removeGameKeyListener(int keyCode, ActionListener listener)
          Removes a game key listener from the given game keycode
 void removeKeyListener(int keyCode, ActionListener listener)
          Removes a key listener from the given keycode
 void removeOrientationListener(ActionListener l)
          This listener is invoked when device orientation changes on devices that support orientation change
 void removePointerDraggedListener(ActionListener l)
          Removes the listener from the pointer event
 void removePointerPressedListener(ActionListener l)
          Removes the listener from the pointer event
 void removePointerReleasedListener(ActionListener l)
          Removes the listener from the pointer event
 void removeShowListener(ActionListener l)
          Removes the show listener
 void replace(Component current, Component next, Transition t)
          This method replaces the current Component with the next Component.
 void replaceAndWait(Component current, Component next, Transition t)
          This method replaces the current Component with the next Component.
 void scrollComponentToVisible(Component c)
          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 setBackCommand(Command backCommand)
          Indicates the command that is defined as the back command out of this form.
 void setBgImage(Image bgImage)
          Deprecated. Use the style directly
 void setClearCommand(Command clearCommand)
          Indicates the command that is defined as the clear command in this form.
 void setCyclicFocus(boolean cyclicFocus)
          Indicates whether focus should cycle within the form
 void setDefaultCommand(Command defaultCommand)
          Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes.
 void setFocused(Component focused)
          Sets the focused component and fires the appropriate events to make it so
 void setFocusScrolling(boolean focusScrolling)
          Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of LWUIT.
 void setGlassPane(Painter glassPane)
          Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations.
 void setLayout(Layout layout)
          Sets the layout manager responsible for arranging this container
 void setMenuBar(MenuBar menuBar)
          Sets the associated MenuBar Object.
 void setMenuCellRenderer(ListCellRenderer menuCellRenderer)
          Determine the cell renderer used to render menu elements for themeing the look of the menu options
 void setMenuTransitions(Transition transitionIn, Transition transitionOut)
          Sets the menu transitions for showing/hiding the menu, can be null...
 void setRTL(boolean r)
          Is the component a bidi RTL component
 void setScrollable(boolean scrollable)
          The equivalent of calling both setScrollableY and setScrollableX
 void setScrollableX(boolean scrollableX)
          Sets whether the component should/could scroll on the X axis
 void setScrollableY(boolean scrollableY)
          Sets whether the component should/could scroll on the Y axis
 void setScrollAnimationSpeed(int animationSpeed)
          Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode
 void setSmoothScrolling(boolean smoothScrolling)
          Indicates that scrolling through the component should work as an animation
 void setTintColor(int tintColor)
          Default color for the screen tint when a dialog or a menu is shown
 void setTitle(java.lang.String title)
          Sets the Form title to the given text
 void setTitleComponent(Label title)
          Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.
 void setTitleComponent(Label title, Transition t)
          Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.
 void setTitleStyle(Style s)
          Deprecated. this method doesn't take into consideration multiple styles
 void setTransitionInAnimator(Transition transitionInAnimator)
          This property allows us to define a an animation that will draw the transition for entering this form.
 void setTransitionOutAnimator(Transition transitionOutAnimator)
          This property allows us to define a an animation that will draw the transition for exiting this form.
 void setVisible(boolean visible)
          Toggles visibility of the component
 void show()
          Displays the current form on the screen
 void showBack()
          Displays the current form on the screen, this version of the method is useful for "back" navigation since it reverses the direction of the transition.
protected  void showNotify()
          This method is only invoked when the underlying canvas for the form is shown this method isn't called for form based events and is generally usable for suspend/resume based behavior
protected  void sizeChanged(int w, int h)
          This method is only invoked when the underlying canvas for the form gets a size changed event.
 
Methods inherited from class com.sun.lwuit.Container
animateLayout, animateLayoutAndWait, applyRTL, calcPreferredSize, contains, dragInitiated, drop, findFirstFocusable, flushReplace, getBottomGap, getComponentAt, getComponentAt, getComponentCount, getGridPosX, getGridPosY, getLayoutHeight, getLayoutWidth, getLeadComponent, getLeadParent, getScrollIncrement, getSideGap, invalidate, isEnabled, isScrollableX, isScrollableY, layoutContainer, paintGlass, replace, replaceAndWait, replaceAndWait, revalidate, setCellRenderer, setEnabled, setLeadComponent, setScrollIncrement, setShouldCalcPreferredSize, setShouldLayout
 
Methods inherited from class com.sun.lwuit.Component
addFocusListener, calcScrollSize, contains, deinitialize, deinitializeCustomStyle, dragEnter, dragExit, draggingOver, drawDraggedImage, fireClicked, focusGained, focusLost, getAbsoluteX, getAbsoluteY, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getDirtyRegion, getDisabledStyle, getDragImage, getHeight, getLabelForComponent, getName, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPreferredH, getPreferredSize, getPreferredW, getPressedStyle, getPropertyNames, getPropertyTypes, getPropertyValue, getScrollDimension, getScrollOpacity, getScrollOpacityChangeSpeed, getScrollX, getScrollY, getSelectCommandText, getSelectedRect, getSelectedStyle, getStyle, getTensileLength, getUIID, getUnselectedStyle, getVisibleBounds, getWidth, getX, getY, growShrink, handlesInput, hasFocus, initComponent, initCustomStyle, installDefaultPainter, isDragActivated, isDragAndDropOperation, isDraggable, isDropTarget, isFlatten, isFocusable, isGrabsPointerEvents, isHideInPortrait, isInitialized, isRTL, isScrollable, isScrollVisible, isSelectableInteraction, isSnapToGrid, isTactileTouch, isTactileTouch, isTensileDragEnabled, isVisible, laidOut, paintBackgrounds, paintBorder, paintComponent, paintComponent, paintLock, paintLockRelease, paintScrollbars, paintScrollbarX, paintScrollbarY, pointerDragged, pointerPressed, pointerReleased, putClientProperty, refreshTheme, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, scrollRectToVisible, setDirtyRegion, setDisabledStyle, setDraggable, setDropTarget, setFlatten, setFocus, setFocusable, setGrabsPointerEvents, setHandlesInput, setHeight, setHideInPortrait, setInitialized, setIsScrollVisible, setLabelForComponent, setName, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredH, setPreferredSize, setPreferredW, setPressedStyle, setPropertyValue, setScrollOpacityChangeSpeed, setScrollSize, setScrollVisible, setScrollX, setScrollY, setSelectCommandText, setSelectedStyle, setSize, setSnapToGrid, setTactileTouch, setTensileDragEnabled, setTensileLength, setUIID, setUnselectedStyle, setWidth, setX, setY, styleChanged, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

focusScrolling

protected boolean focusScrolling
Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of LWUIT.

Constructor Detail

Form

public Form()
Default constructor creates a simple form


Form

public Form(java.lang.String title)
Sets the title after invoking the constructor

Parameters:
title - the form title
Method Detail

isAlwaysTensile

public boolean isAlwaysTensile()
Description copied from class: Component
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)

Overrides:
isAlwaysTensile in class Component
Returns:
the alwaysTensile

setAlwaysTensile

public void setAlwaysTensile(boolean alwaysTensile)
Description copied from class: Component
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)

Overrides:
setAlwaysTensile in class Component
Parameters:
alwaysTensile - the alwaysTensile to set

getTitleArea

public Container getTitleArea()
Title area manipulation might break with future changes to LWUIT and might damage themeing/functionality of the LWUIT application in some platforms

Returns:
the container containing the title

addShowListener

public void addShowListener(ActionListener l)
This listener would be invoked when show is completed

Parameters:
l - listener

removeShowListener

public void removeShowListener(ActionListener l)
Removes the show listener

Parameters:
l - the listener

addOrientationListener

public void addOrientationListener(ActionListener l)
This listener is invoked when device orientation changes on devices that support orientation change

Parameters:
l - listener

removeOrientationListener

public void removeOrientationListener(ActionListener l)
This listener is invoked when device orientation changes on devices that support orientation change

Parameters:
l - the listener

hideNotify

protected void hideNotify()
This method is only invoked when the underlying canvas for the form is hidden this method isn't called for form based events and is generally usable for suspend/resume based behavior


showNotify

protected void showNotify()
This method is only invoked when the underlying canvas for the form is shown this method isn't called for form based events and is generally usable for suspend/resume based behavior


sizeChanged

protected void sizeChanged(int w,
                           int h)
This method is only invoked when the underlying canvas for the form gets a size changed event. This method will trigger a relayout of the Form. This method will get the callback only if this Form is the Current Form

Parameters:
w - the new width of the Form
h - the new height of the Form

setGlassPane

public void setGlassPane(Painter glassPane)
Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations. This is useful for watermarks or special effects (such as tinting) it is also useful for generic drawing of validation errors etc... A glass pane is generally transparent or translucent and allows the the UI bellow to be seen.

Parameters:
glassPane - a new glass pane to install. It is generally recommended to use a painter chain if more than one painter is required.

getGlassPane

public Painter getGlassPane()
Allows a developer that doesn't derive from the form to draw on top of the form regardless of underlying changes or animations. This is useful for watermarks or special effects (such as tinting) it is also useful for generic drawing of validation errors etc... A glass pane is generally transparent or translucent and allows the the UI bellow to be seen.

Returns:
the instance of the glass pane for this form
See Also:
PainterChain.installGlassPane(Form, com.sun.lwuit.Painter)

setTitleStyle

public void setTitleStyle(Style s)
Deprecated. this method doesn't take into consideration multiple styles

Sets the style of the title programmatically

Parameters:
s - new style

getTitleComponent

public Label getTitleComponent()
Allows modifying the title attributes beyond style (e.g. setting icon/alignment etc.)

Returns:
the component representing the title for the form

setTitleComponent

public void setTitleComponent(Label title)
Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects.

Parameters:
title - new title component

setTitleComponent

public void setTitleComponent(Label title,
                              Transition t)
Allows replacing the title with a different title component, thus allowing developers to create more elaborate title objects. This version of the method allows special effects for title replacement such as transitions for title entering

Parameters:
title - new title component
t - transition for title replacement

addKeyListener

public void addKeyListener(int keyCode,
                           ActionListener listener)
Add a key listener to the given keycode for a callback when the key is released

Parameters:
keyCode - code on which to send the event
listener - listener to invoke when the key code released.

removeKeyListener

public void removeKeyListener(int keyCode,
                              ActionListener listener)
Removes a key listener from the given keycode

Parameters:
keyCode - code on which the event is sent
listener - listener instance to remove

removeGameKeyListener

public void removeGameKeyListener(int keyCode,
                                  ActionListener listener)
Removes a game key listener from the given game keycode

Parameters:
keyCode - code on which the event is sent
listener - listener instance to remove

addGameKeyListener

public void addGameKeyListener(int keyCode,
                               ActionListener listener)
Add a game key listener to the given gamekey for a callback when the key is released

Parameters:
keyCode - code on which to send the event
listener - listener to invoke when the key code released.

getSoftButtonCount

public int getSoftButtonCount()
Returns the number of buttons on the menu bar for use with getSoftButton()

Returns:
the number of softbuttons

getSoftButton

public Button getSoftButton(int offset)
Returns the button representing the softbutton, this allows modifying softbutton attributes and behavior programmatically rather than by using the command API. Notice that this API behavior is fragile since the button mapped to a particular offset might change based on the command API

Parameters:
offset - the offest of the softbutton
Returns:
a button that can be manipulated

getMenuStyle

public Style getMenuStyle()
Returns the style of the menu

Returns:
the style of the menu

getTitleStyle

public Style getTitleStyle()
Returns the style of the title

Returns:
the style of the title

setDefaultCommand

public void setDefaultCommand(Command defaultCommand)
Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. Use with caution.

Parameters:
defaultCommand - the command to treat as default

getDefaultCommand

public Command getDefaultCommand()
Default command is invoked when a user presses fire, this functionality works well in some situations but might collide with elements such as navigation and combo boxes. Use with caution.

Returns:
the command to treat as default

setClearCommand

public void setClearCommand(Command clearCommand)
Indicates the command that is defined as the clear command in this form. A clear command can be used both to map to a "clear" hardware button if such a button exists.

Parameters:
clearCommand - the command to treat as the clear Command

getClearCommand

public Command getClearCommand()
Indicates the command that is defined as the clear command in this form. A clear command can be used both to map to a "clear" hardware button if such a button exists.

Returns:
the command to treat as the clear Command

setBackCommand

public void setBackCommand(Command backCommand)
Indicates the command that is defined as the back command out of this form. A back command can be used both to map to a hardware button (e.g. on the Sony Ericsson devices) and by elements such as transitions etc. to change the behavior based on direction (e.g. slide to the left to enter screen and slide to the right to exit with back).

Parameters:
backCommand - the command to treat as the back Command

getBackCommand

public Command getBackCommand()
Indicates the command that is defined as the back command out of this form. A back command can be used both to map to a hardware button (e.g. on the Sony Ericsson devices) and by elements such as transitions etc. to change the behavior based on direction (e.g. slide to the left to enter screen and slide to the right to exit with back).

Returns:
the command to treat as the back Command

getContentPane

public Container getContentPane()
This method returns the Content pane instance

Returns:
a content pane instance

removeAll

public void removeAll()
Removes all Components from the Content Pane

Overrides:
removeAll in class Container

setBgImage

public void setBgImage(Image bgImage)
Deprecated. Use the style directly

Sets the background image to show behind the form

Parameters:
bgImage - the background image

setLayout

public void setLayout(Layout layout)
Description copied from class: Container
Sets the layout manager responsible for arranging this container

Overrides:
setLayout in class Container
Parameters:
layout - the specified layout manager

setTitle

public void setTitle(java.lang.String title)
Sets the Form title to the given text

Parameters:
title - the form title

getTitle

public java.lang.String getTitle()
Returns the Form title text

Returns:
returns the form title

addComponent

public void addComponent(Component cmp)
Adds Component to the Form's Content Pane

Overrides:
addComponent in class Container
Parameters:
cmp - the added param

addComponent

public void addComponent(java.lang.Object constraints,
                         Component cmp)
Description copied from class: Container
Adds a Component to the Container

Overrides:
addComponent in class Container
Parameters:
constraints - this method is useful when the Layout requires a constraint such as the BorderLayout. In this case you need to specify an additional data when you add a Component, such as "CENTER", "NORTH"...
cmp - component to add

addComponent

public void addComponent(int index,
                         java.lang.Object constraints,
                         Component cmp)
Description copied from class: Container
Adds a Component to the Container

Overrides:
addComponent in class Container
Parameters:
index - location to insert the Component
constraints - this method is useful when the Layout requires a constraint such as the BorderLayout. In this case you need to specify an additional data when you add a Component, such as "CENTER", "NORTH"...
cmp - component to add

addComponent

public void addComponent(int index,
                         Component cmp)
Adds Component to the Form's Content Pane

Overrides:
addComponent in class Container
Parameters:
cmp - the added param
index - location to insert the Component

replace

public void replace(Component current,
                    Component next,
                    Transition t)
Description copied from class: Container
This method replaces the current Component with the next Component. Current Component must be contained in this Container. This method return immediately.

Overrides:
replace in class Container
Parameters:
current - a Component to remove from the Container
next - a Component that replaces the current Component
t - a Transition between the add and removal of the Components a Transition can be null

replaceAndWait

public void replaceAndWait(Component current,
                           Component next,
                           Transition t)
Description copied from class: Container
This method replaces the current Component with the next Component. Current Component must be contained in this Container. This method returns when transition has finished.

Overrides:
replaceAndWait in class Container
Parameters:
current - a Component to remove from the Container
next - a Component that replaces the current Component
t - a Transition between the add and removal of the Components a Transition can be null

removeComponent

public void removeComponent(Component cmp)
Removes a component from the Form's Content Pane

Overrides:
removeComponent in class Container
Parameters:
cmp - the component to be removed

hasMedia

public final boolean hasMedia()
Used by the implementation to prevent flickering when flushing the double buffer

Returns:
true if the form has media components within it

registerAnimated

public void registerAnimated(Animation cmp)
The given component is interested in animating its appearance and will start receiving callbacks when it is visible in the form allowing it to animate its appearance. This method would not register a compnent instance more than once

Parameters:
cmp - component that would be animated

deregisterAnimated

public void deregisterAnimated(Animation cmp)
Indicate that cmp would no longer like to receive animation events

Parameters:
cmp - component that would no longer receive animation events

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
Overrides:
animate in class Component
Returns:
true if a repaint is desired or false if no repaint is necessary

refreshTheme

public void refreshTheme()
Description copied from class: Component
Makes sure the component is up to date with the current style object

Overrides:
refreshTheme in class Container

paintBackground

public void paintBackground(Graphics g)
Exposing the background painting for the benefit of animations

Overrides:
paintBackground in class Container
Parameters:
g - the form graphics

getTransitionInAnimator

public Transition getTransitionInAnimator()
This property allows us to define a an animation that will draw the transition for entering this form. A transition is an animation that would occur when switching from one form to another.

Returns:
the Form in transition

setTransitionInAnimator

public void setTransitionInAnimator(Transition transitionInAnimator)
This property allows us to define a an animation that will draw the transition for entering this form. A transition is an animation that would occur when switching from one form to another.

Parameters:
transitionInAnimator - the Form in transition

getTransitionOutAnimator

public Transition getTransitionOutAnimator()
This property allows us to define a an animation that will draw the transition for exiting this form. A transition is an animation that would occur when switching from one form to another.

Returns:
the Form out transition

setTransitionOutAnimator

public void setTransitionOutAnimator(Transition transitionOutAnimator)
This property allows us to define a an animation that will draw the transition for exiting this form. A transition is an animation that would occur when switching from one form to another.

Parameters:
transitionOutAnimator - the Form out transition

addCommandListener

public void addCommandListener(ActionListener l)
A listener that is invoked when a command is clicked allowing multiple commands to be handled by a single block

Parameters:
l - the command action listener

removeCommandListener

public void removeCommandListener(ActionListener l)
A listener that is invoked when a command is clicked allowing multiple commands to be handled by a single block

Parameters:
l - the command action listener

actionCommand

protected void actionCommand(Command cmd)
Invoked to allow subclasses of form to handle a command from one point rather than implementing many command instances. All commands selected on the form will trigger this method implicitly.

Parameters:
cmd - the form commmand object

dispatchCommand

public void dispatchCommand(Command cmd,
                            ActionEvent ev)
Dispatches a command via the standard form mechanism of firing a command event

Parameters:
cmd - The command to dispatch
ev - the event to dispatch

show

public void show()
Displays the current form on the screen


showBack

public void showBack()
Displays the current form on the screen, this version of the method is useful for "back" navigation since it reverses the direction of the transition.


setSmoothScrolling

public void setSmoothScrolling(boolean smoothScrolling)
Description copied from class: Component
Indicates that scrolling through the component should work as an animation

Overrides:
setSmoothScrolling in class Component
Parameters:
smoothScrolling - indicates if a component uses smooth scrolling

isSmoothScrolling

public boolean isSmoothScrolling()
Description copied from class: Component
Indicates that scrolling through the component should work as an animation

Overrides:
isSmoothScrolling in class Component
Returns:
whether this component use smooth scrolling

getScrollAnimationSpeed

public int getScrollAnimationSpeed()
Description copied from class: Component
Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode

Overrides:
getScrollAnimationSpeed in class Component
Returns:
scroll animation speed in milliseconds

setScrollAnimationSpeed

public void setScrollAnimationSpeed(int animationSpeed)
Description copied from class: Component
Scroll animation speed in milliseconds allowing a developer to slow down or accelerate the smooth animation mode

Overrides:
setScrollAnimationSpeed in class Component
Parameters:
animationSpeed - scroll animation speed in milliseconds

onShow

protected void onShow()
Allows subclasses to bind functionality that occurs when a specific form or dialog appears on the screen


onShowCompleted

protected void onShowCompleted()
Allows subclasses to bind functionality that occurs when a specific form or dialog is "really" showing hence when the transition is totally complete (unlike onShow which is called on intent). The necessity for this is for special cases like media that might cause artifacts if played during a transition.


getComponentForm

public final Form getComponentForm()
Description copied from class: Component
Returns the Component Form or null if this Component is not added yet to a form

Overrides:
getComponentForm in class Component
Returns:
the Component Form

setFocused

public void setFocused(Component focused)
Sets the focused component and fires the appropriate events to make it so

Parameters:
focused - the newly focused component or null for no focus

getFocused

public Component getFocused()
Returns the current focus component for this form

Returns:
the current focus component for this form

longKeyPress

protected void longKeyPress(int keyCode)
Description copied from class: Component
If this Component is focused this method is invoked when the user presses and holds the key

Overrides:
longKeyPress in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

longPointerPress

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

Overrides:
longPointerPress in class Component

keyPressed

public void keyPressed(int keyCode)
Description copied from class: Component
If this Component is focused, the key pressed event will call this method

Overrides:
keyPressed in class Container
Parameters:
keyCode - the key code value to indicate a physical key.

getLayout

public Layout getLayout()
Description copied from class: Container
Returns the layout manager responsible for arranging this container

Overrides:
getLayout in class Container
Returns:
the container layout manager

keyReleased

public void keyReleased(int keyCode)
Description copied from class: Component
If this Component is focused, the key released event will call this method

Overrides:
keyReleased in class Container
Parameters:
keyCode - the key code value to indicate a physical key.

keyRepeated

public void keyRepeated(int keyCode)
Description copied from class: Component
If this Component is focused, the key repeat event will call this method.

Overrides:
keyRepeated in class Component
Parameters:
keyCode - the key code value to indicate a physical key.

pointerPressed

public void pointerPressed(int x,
                           int y)
Description copied from class: Component
If this Component is focused, the pointer pressed event will call this method

Overrides:
pointerPressed in class Container
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

addPointerPressedListener

public void addPointerPressedListener(ActionListener l)
Adds a listener to the pointer event

Parameters:
l - callback to receive pointer events

removePointerPressedListener

public void removePointerPressedListener(ActionListener l)
Removes the listener from the pointer event

Parameters:
l - callback to remove

addPointerReleasedListener

public void addPointerReleasedListener(ActionListener l)
Adds a listener to the pointer event

Parameters:
l - callback to receive pointer events

removePointerReleasedListener

public void removePointerReleasedListener(ActionListener l)
Removes the listener from the pointer event

Parameters:
l - callback to remove

addPointerDraggedListener

public void addPointerDraggedListener(ActionListener l)
Adds a listener to the pointer event

Parameters:
l - callback to receive pointer events

removePointerDraggedListener

public void removePointerDraggedListener(ActionListener l)
Removes the listener from the pointer event

Parameters:
l - callback to remove

pointerDragged

public void pointerDragged(int x,
                           int y)
Description copied from class: Component
If this Component is focused, the pointer dragged event will call this method

Overrides:
pointerDragged in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerHoverReleased

public void pointerHoverReleased(int[] x,
                                 int[] y)
Description copied from class: Component
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.

Overrides:
pointerHoverReleased in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerHoverPressed

public void pointerHoverPressed(int[] x,
                                int[] y)
Description copied from class: Component
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.

Overrides:
pointerHoverPressed in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

pointerHover

public void pointerHover(int[] x,
                         int[] y)
Description copied from class: Component
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.

Overrides:
pointerHover in class Container
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

isSingleFocusMode

public boolean isSingleFocusMode()
Returns true if there is only one focusable member in this form. This is useful so setHandlesInput would always be true for this case.

Returns:
true if there is one focusable component in this form, false for 0 or more

pointerReleased

public void pointerReleased(int x,
                            int y)
Description copied from class: Component
If this Component is focused, the pointer released event will call this method

Overrides:
pointerReleased in class Component
Parameters:
x - the pointer x coordinate
y - the pointer y coordinate

setScrollableY

public void setScrollableY(boolean scrollableY)
Description copied from class: Container
Sets whether the component should/could scroll on the Y axis

Overrides:
setScrollableY in class Container
Parameters:
scrollableY - whether the component should/could scroll on the Y axis

setScrollableX

public void setScrollableX(boolean scrollableX)
Description copied from class: Container
Sets whether the component should/could scroll on the X axis

Overrides:
setScrollableX in class Container
Parameters:
scrollableX - whether the component should/could scroll on the X axis

getComponentIndex

public int getComponentIndex(Component cmp)
Description copied from class: Container
Returns the Component index in the Container

Overrides:
getComponentIndex in class Container
Parameters:
cmp - the component to search for
Returns:
the Component index in the Container or -1 if not found

addCommand

public void addCommand(Command cmd,
                       int offset)
Adds a command to the menu bar softkeys or into the menu dialog, this version of add allows us to place a command in an arbitrary location. This allows us to force a command into the softkeys when order of command addition can't be changed.

Parameters:
cmd - the Form command to be added
offset - position in which the command is added

getCommandCount

public int getCommandCount()
A helper method to check the amount of commands within the form menu

Returns:
the number of commands

getCommand

public Command getCommand(int index)
Returns the command occupying the given index

Parameters:
index - offset of the command
Returns:
the command at the given index

addCommand

public void addCommand(Command cmd)
Adds a command to the menu bar softkeys. The Commands are placed in the order they are added. If the Form has 1 Command it will be placed on the right. If the Form has 2 Commands the first one that was added will be placed on the right and the second one will be placed on the left. If the Form has more then 2 Commands the first one will stay on the left and a Menu will be added with all the remain Commands.

Parameters:
cmd - the Form command to be added

removeCommand

public void removeCommand(Command cmd)
Removes the command from the menu bar softkeys

Parameters:
cmd - the Form command to be removed

setCyclicFocus

public void setCyclicFocus(boolean cyclicFocus)
Indicates whether focus should cycle within the form

Parameters:
cyclicFocus - marks whether focus should cycle

findNextFocusVertical

public Component findNextFocusVertical(boolean down)
This method returns the next focusable Component vertically

Parameters:
down - if true will the return the next focusable on the bottom else on the top
Returns:
a focusable Component or null if not found

findNextFocusHorizontal

public Component findNextFocusHorizontal(boolean right)
This method returns the next focusable Component horizontally

Parameters:
right - if true will the return the next focusable on the right else on the left
Returns:
a focusable Component or null if not found

isCyclicFocus

public boolean isCyclicFocus()
Indicates whether focus should cycle within the form

Returns:
true if focus should cycle

scrollComponentToVisible

public void scrollComponentToVisible(Component c)
Makes sure the component is visible in the scroll if this container is scrollable

Overrides:
scrollComponentToVisible in class Container
Parameters:
c - the componant to be visible

setMenuCellRenderer

public void setMenuCellRenderer(ListCellRenderer menuCellRenderer)
Determine the cell renderer used to render menu elements for themeing the look of the menu options

Parameters:
menuCellRenderer - the menu cell renderer

removeAllCommands

public void removeAllCommands()
Clear menu commands from the menu bar


setRTL

public void setRTL(boolean r)
Description copied from class: Component
Is the component a bidi RTL component

Overrides:
setRTL in class Component
Parameters:
r - true if the component should work in a right to left mode

paint

public void paint(Graphics g)
Description copied from class: Component
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
Overrides:
paint in class Container
Parameters:
g - the component graphics

setScrollable

public void setScrollable(boolean scrollable)
Description copied from class: Container
The equivalent of calling both setScrollableY and setScrollableX

Overrides:
setScrollable in class Container
Parameters:
scrollable - whether the component should/could scroll on the X and Y axis

setVisible

public void setVisible(boolean visible)
Description copied from class: Component
Toggles visibility of the component

Overrides:
setVisible in class Component
Parameters:
visible - true if component is visible; otherwise false

getTintColor

public int getTintColor()
Default color for the screen tint when a dialog or a menu is shown

Returns:
the tint color when a dialog or a menu is shown

setTintColor

public void setTintColor(int tintColor)
Default color for the screen tint when a dialog or a menu is shown

Parameters:
tintColor - the tint color when a dialog or a menu is shown

setMenuTransitions

public void setMenuTransitions(Transition transitionIn,
                               Transition transitionOut)
Sets the menu transitions for showing/hiding the menu, can be null...

Parameters:
transitionIn - the transition that will play when the menu appears
transitionOut - the transition that will play when the menu is folded

paramString

protected java.lang.String paramString()
Description copied from class: Component
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.

Overrides:
paramString in class Container
Returns:
a string representation of this component's state

getMenuBar

public MenuBar getMenuBar()
Returns the associated Menu Bar object

Returns:
the associated Menu Bar object

setMenuBar

public void setMenuBar(MenuBar menuBar)
Sets the associated MenuBar Object.

Parameters:
menuBar -

isFocusScrolling

public boolean isFocusScrolling()
Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of LWUIT.

Returns:
the value of focusScrolling

setFocusScrolling

public void setFocusScrolling(boolean focusScrolling)
Indicates whether lists and containers should scroll only via focus and thus "jump" when moving to a larger component as was the case in older versions of LWUIT.

Parameters:
focusScrolling - the new value for focus scrolling


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