Java DTV API 1.3
18-Nov-2009

com.sun.dtv.lwuit
Class Form

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

public class Form
extends Container

Top level component that serves as the top-most visible entity in the UI (directly embedded into the DTVContainer, 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
 
Fields inherited from class com.sun.dtv.lwuit.Component
BOTTOM, BRB_CENTER_OFFSET, BRB_CONSTANT_ASCENT, BRB_CONSTANT_DESCENT, BRB_OTHER, CENTER, LEFT, RIGHT, TOP
 
Fields inherited from interface com.sun.dtv.ui.Animated
ALTERNATING, LOOP, REPEATING
 
Constructor Summary
Form()
          Default constructor creates a simple form.
Form(String title)
          Sets the title after invoking the constructor.
 
Method Summary
 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 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(Object constraints, Component cmp)
          Adds Component to the Form's Content Pane.
 void addGameKeyListener(int keyCode, ActionListener listener)
          Add a game key listener to the given game key 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 deregisterAnimation(Animation cmp)
          Indicate that cmp would no longer like to receive animation events.
 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 to a form.
 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.
 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().
 Style getSoftButtonStyle()
          Retrieves the style of the menu bar programmatically.
 Color getTintColor()
          Default color for the screen tint when a dialog or a menu is shown.
 String getTitle()
          Returns the Form title text.
 Label getTitleComponent()
          Allows modifying the title attributes beyond style (like setting icon/alignment etc).
 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.
protected  void hideNotify()
          This method is only invoked when the graphical environment for the form is hidden.
 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.
 void longKeyPress(int keyCode)
          If this Component is focused this method is invoked when the user presses and holds the key.
protected  void onShow()
          Allows subclasses to bind functionality that occurs immediately after a specific form or dialog appears on the screen
 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.
 void pointerDragged(int x, int y)
          If this Component is focused, the pointer dragged event will call this method.
 void pointerPressed(int x, int y)
          If this Component is focused, the pointer pressed event will call this method.
 void pointerReleased(int x, int y)
          If this Component is focused, the pointer released event will call this method.
 void refreshTheme()
          Makes sure the component is up to date with the current style object.
 void registerAnimation(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 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 replace(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 setBackCommand(Command backCommand)
          Indicates the command that is defined as the back command out of this form.
 void setBgImage(Image bgImage)
          Sets the background image to show behind the form.
 void setClearCommand(Command clearCommand)
          Indicates the command that is defined as the clear command in this form.
 void setCommandListener(ActionListener commandListener)
          A listener that is invoked when a command is clicked allowing multiple commands to be handled by a single block.
 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 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 setMenuCellRenderer(ListCellRenderer menuCellRenderer)
          Determine the cell renderer used to render menu elements for theming the look of the menu options.
 void setMenuTransitions(Transition transitionIn, Transition transitionOut)
          Sets the menu transitions for showing/hiding the menu.
 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 setSoftButtonStyle(Style s)
          Sets the style of the menu bar programmatically.
 void setTintColor(Color tintColor)
          Default color for the screen tint when a dialog or a menu is shown.
 void setTitle(String title)
          Sets the Form title to the given text.
 void setTitleStyle(Style s)
          Sets the style of the title programmatically.
 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.
protected  Command showMenuDialog(Dialog menu)
          If a menu is implemented as a dialog, this method allows to override dialog display in order to customize the dialog menu in various ways
protected  void showNotify()
          This method is only invoked when the graphical environment for the form is shown.
protected  void sizeChanged(int w, int h)
          This method is only invoked when the graphical environment for the form receives a size changed event.
 
Methods inherited from class com.sun.dtv.lwuit.Container
contains, doLayout, getComponentAt, getComponentAt, getComponentCount, getComponentIndex, getLayout, getLayoutHeight, getLayoutWidth, getMatte, invalidate, isScrollableX, isScrollableY, layoutContainer, revalidate, setCellRenderer, setMatte
 
Methods inherited from class com.sun.dtv.lwuit.Component
addFocusListener, animate, calcPreferredSize, contains, deinitialize, getAbsoluteX, getAbsoluteY, getAnimationMode, getBaseline, getBaselineResizeBehavior, getBottomGap, getBounds, getClientProperty, getDelay, getHeight, getNextFocusDown, getNextFocusLeft, getNextFocusRight, getNextFocusUp, getParent, getPosition, getPreferredSize, getRepetitionMode, getScrollX, getScrollY, getSideGap, getStyle, getUIID, getWidth, getX, getY, handlesInput, hasFocus, initialize, isEnabled, isFocusable, isFocusPainted, isInitialized, isRunning, isScrollVisible, isVisible, jumpTo, paintBackgrounds, paintComponent, paintComponent, putClientProperty, removeFocusListener, repaint, repaint, requestFocus, scrollRectToVisible, setAnimationMode, setDelay, setEnabled, setFocus, setFocusable, setFocusPainted, setHandlesInput, setHeight, setInitialized, setIsScrollVisible, setNextFocusDown, setNextFocusLeft, setNextFocusRight, setNextFocusUp, setPreferredSize, setRepetitionMode, setScrollX, setScrollY, setShouldCalcPreferredSize, setSize, setStyle, setUIID, setWidth, setX, setY, start, stop, styleChanged, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Form

public Form()
Default constructor creates a simple form.


Form

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

Parameters:
title - the form title
Method Detail

setSoftButtonStyle

public void setSoftButtonStyle(Style s)
Sets the style of the menu bar programmatically.

Parameters:
s - new style
See Also:
getSoftButtonStyle()

getSoftButtonStyle

public Style getSoftButtonStyle()
Retrieves the style of the menu bar programmatically.

Returns:
a Style object representing the soft button style value
See Also:
setSoftButtonStyle(com.sun.dtv.lwuit.plaf.Style)

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.
See Also:
getGlassPane()

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:
setGlassPane(com.sun.dtv.lwuit.Painter), PainterChain.installGlassPane(Form, com.sun.dtv.lwuit.Painter)

setTitleStyle

public void setTitleStyle(Style s)
Sets the style of the title programmatically.

Parameters:
s - new style
See Also:
getTitleStyle()

getTitleComponent

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

Returns:
the component representing the title for the form

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.
See Also:
removeKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)

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
See Also:
addKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)

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
See Also:
addGameKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)

addGameKeyListener

public void addGameKeyListener(int keyCode,
                               ActionListener listener)
Add a game key listener to the given game key 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.
See Also:
removeGameKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)

getSoftButtonCount

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

Returns:
an int representing the soft button count value

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 offset the soft button is mapped to
Returns:
a button that can be manipulated

getTitleStyle

public Style getTitleStyle()
Returns the style of the title.

Returns:
a Style object representing the title style value
See Also:
setTitleStyle(com.sun.dtv.lwuit.plaf.Style)

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 - a Command object specifying the default command value
See Also:
getDefaultCommand()

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:
a Command object representing the default command value
See Also:
setDefaultCommand(com.sun.dtv.lwuit.Command)

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 - a Command object specifying the clear command value
See Also:
getClearCommand()

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:
a Command object representing the clear command value
See Also:
setClearCommand(com.sun.dtv.lwuit.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 - a Command object specifying the back command value
See Also:
getBackCommand()

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:
a Command object representing the back command value
See Also:
setBackCommand(com.sun.dtv.lwuit.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)
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
See Also:
Container.getLayout()

setTitle

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

Parameters:
title - the form title
See Also:
getTitle()

getTitle

public String getTitle()
Returns the Form title text.

Returns:
a String representing the title value
See Also:
setTitle(java.lang.String)

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(Object constraints,
                         Component cmp)
Adds Component to the Form's Content Pane.

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,
                         Component cmp)
Adds Component to the Form's Content Pane.

Overrides:
addComponent in class Container
Parameters:
index - index where to add the component
cmp - the added param

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

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

registerAnimation

public void registerAnimation(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 component instance more than once.

Parameters:
cmp - component that would be animated

deregisterAnimation

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

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

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.

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
See Also:
setTransitionInAnimator(com.sun.dtv.lwuit.animations.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
See Also:
getTransitionInAnimator()

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
See Also:
setTransitionOutAnimator(com.sun.dtv.lwuit.animations.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
See Also:
getTransitionOutAnimator()

setCommandListener

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

Parameters:
commandListener - the command action listener

show

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


setSmoothScrolling

public void setSmoothScrolling(boolean smoothScrolling)
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()
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()
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
See Also:
setScrollAnimationSpeed(int)

setScrollAnimationSpeed

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

Overrides:
setScrollAnimationSpeed in class Component
Parameters:
animationSpeed - scroll animation speed in milliseconds
See Also:
getScrollAnimationSpeed()

getComponentForm

public final Form getComponentForm()
Returns the Component Form or null if this Component is not added 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
See Also:
getFocused()

getFocused

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

Returns:
the current focus component for this form
See Also:
setFocused(com.sun.dtv.lwuit.Component)

longKeyPress

public void longKeyPress(int keyCode)
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.

keyPressed

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

Overrides:
keyPressed in class Component
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.

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

keyRepeated

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

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

pointerPressed

public void pointerPressed(int x,
                           int y)
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

pointerDragged

public void pointerDragged(int x,
                           int y)
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

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

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:
an int representing the command count value

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

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 component to be visible

setMenuCellRenderer

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

Parameters:
menuCellRenderer - the menu cell renderer

removeAllCommands

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


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
Overrides:
paint in class Container
Parameters:
g - the component graphics

setScrollable

public void setScrollable(boolean scrollable)
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)
Toggles visibility of the component.

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

getTintColor

public Color 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
See Also:
setTintColor(java.awt.Color)

setTintColor

public void setTintColor(Color 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
See Also:
getTintColor()

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

onShow

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


sizeChanged

protected void sizeChanged(int w,
                           int h)
This method is only invoked when the graphical environment for the form receives 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

hideNotify

protected void hideNotify()
This method is only invoked when the graphical environment 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 graphical environment for the form is shown. This method isn't called for form based events and is generally usable for suspend/resume based behavior


showMenuDialog

protected Command showMenuDialog(Dialog menu)
If a menu is implemented as a dialog, this method allows to override dialog display in order to customize the dialog menu in various ways

Parameters:
menu - a dialog containing menu options that can be customized
Returns:
the command selected by the user in the dialog (not menu), one of Select or Cancel

Java DTV API 1.3
18-Nov-2009

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

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

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

Use of this document is subject to license terms.