|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sun.dtv.lwuit.Component
com.sun.dtv.lwuit.Container
com.sun.dtv.lwuit.Form
public class Form
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Form()
public Form(String title)
title
- the form titleMethod Detail |
---|
public void setSoftButtonStyle(Style s)
s
- new stylegetSoftButtonStyle()
public Style getSoftButtonStyle()
setSoftButtonStyle(com.sun.dtv.lwuit.plaf.Style)
public void setGlassPane(Painter glassPane)
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()
setGlassPane(com.sun.dtv.lwuit.Painter)
,
PainterChain.installGlassPane(Form, com.sun.dtv.lwuit.Painter)
public void setTitleStyle(Style s)
s
- new stylegetTitleStyle()
public Label getTitleComponent()
public void addKeyListener(int keyCode, ActionListener listener)
keyCode
- code on which to send the eventlistener
- listener to invoke when the key code released.removeKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)
public void removeKeyListener(int keyCode, ActionListener listener)
keyCode
- code on which the event is sentlistener
- listener instance to removeaddKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)
public void removeGameKeyListener(int keyCode, ActionListener listener)
keyCode
- code on which the event is sentlistener
- listener instance to removeaddGameKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)
public void addGameKeyListener(int keyCode, ActionListener listener)
keyCode
- code on which to send the eventlistener
- listener to invoke when the key code released.removeGameKeyListener(int, com.sun.dtv.lwuit.events.ActionListener)
public int getSoftButtonCount()
public Button getSoftButton(int offset)
offset
- the offset the soft button is mapped to
public Style getTitleStyle()
setTitleStyle(com.sun.dtv.lwuit.plaf.Style)
public void setDefaultCommand(Command defaultCommand)
defaultCommand
- a Command object specifying the default command valuegetDefaultCommand()
public Command getDefaultCommand()
setDefaultCommand(com.sun.dtv.lwuit.Command)
public void setClearCommand(Command clearCommand)
clearCommand
- a Command object specifying the clear command valuegetClearCommand()
public Command getClearCommand()
setClearCommand(com.sun.dtv.lwuit.Command)
public void setBackCommand(Command backCommand)
backCommand
- a Command object specifying the back command valuegetBackCommand()
public Command getBackCommand()
setBackCommand(com.sun.dtv.lwuit.Command)
public Container getContentPane()
public void removeAll()
removeAll
in class Container
public void setBgImage(Image bgImage)
bgImage
- the background imagepublic void setLayout(Layout layout)
Container
setLayout
in class Container
layout
- the specified layout managerContainer.getLayout()
public void setTitle(String title)
title
- the form titlegetTitle()
public String getTitle()
setTitle(java.lang.String)
public void addComponent(Component cmp)
addComponent
in class Container
cmp
- the added parampublic void addComponent(Object constraints, Component cmp)
addComponent
in class Container
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 addpublic void addComponent(int index, Component cmp)
addComponent
in class Container
index
- index where to add the componentcmp
- the added parampublic void replace(Component current, Component next, Transition t)
Container
replace
in class Container
current
- a Component to remove from the Containernext
- a Component that replaces the current Componentt
- a Transition between the add and removal of the Components
a Transition can be nullpublic void removeComponent(Component cmp)
removeComponent
in class Container
cmp
- the component to be removedpublic void registerAnimation(Animation cmp)
cmp
- component that would be animatedpublic void deregisterAnimation(Animation cmp)
cmp
- component that would no longer receive animation eventspublic void refreshTheme()
Component
refreshTheme
in class Container
public void paintBackground(Graphics g)
g
- the form graphicspublic Transition getTransitionInAnimator()
setTransitionInAnimator(com.sun.dtv.lwuit.animations.Transition)
public void setTransitionInAnimator(Transition transitionInAnimator)
transitionInAnimator
- the Form in transitiongetTransitionInAnimator()
public Transition getTransitionOutAnimator()
setTransitionOutAnimator(com.sun.dtv.lwuit.animations.Transition)
public void setTransitionOutAnimator(Transition transitionOutAnimator)
transitionOutAnimator
- the Form out transitiongetTransitionOutAnimator()
public void setCommandListener(ActionListener commandListener)
commandListener
- the command action listenerpublic void show()
public void setSmoothScrolling(boolean smoothScrolling)
setSmoothScrolling
in class Component
smoothScrolling
- indicates if a component uses smooth scrollingpublic boolean isSmoothScrolling()
isSmoothScrolling
in class Component
public int getScrollAnimationSpeed()
getScrollAnimationSpeed
in class Component
setScrollAnimationSpeed(int)
public void setScrollAnimationSpeed(int animationSpeed)
setScrollAnimationSpeed
in class Component
animationSpeed
- scroll animation speed in millisecondsgetScrollAnimationSpeed()
public final Form getComponentForm()
getComponentForm
in class Component
public void setFocused(Component focused)
focused
- the newly focused component or null for no focusgetFocused()
public Component getFocused()
setFocused(com.sun.dtv.lwuit.Component)
public void longKeyPress(int keyCode)
longKeyPress
in class Component
keyCode
- the key code value to indicate a physical key.public void keyPressed(int keyCode)
keyPressed
in class Component
keyCode
- the key code value to indicate a physical key.public void keyReleased(int keyCode)
keyReleased
in class Component
keyCode
- the key code value to indicate a physical key.public void keyRepeated(int keyCode)
keyRepeated
in class Component
keyCode
- the key code value to indicate a physical key.public void pointerPressed(int x, int y)
pointerPressed
in class Container
x
- the pointer x coordinatey
- the pointer y coordinatepublic void pointerDragged(int x, int y)
pointerDragged
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic boolean isSingleFocusMode()
public void pointerReleased(int x, int y)
pointerReleased
in class Component
x
- the pointer x coordinatey
- the pointer y coordinatepublic void setScrollableY(boolean scrollableY)
setScrollableY
in class Container
scrollableY
- whether the component should/could scroll on the Y axispublic void setScrollableX(boolean scrollableX)
setScrollableX
in class Container
scrollableX
- whether the component should/could scroll on the X axispublic void addCommand(Command cmd, int offset)
cmd
- the Form command to be addedoffset
- position in which the command is addedpublic int getCommandCount()
public Command getCommand(int index)
index
- offset of the command
public void addCommand(Command cmd)
cmd
- the Form command to be addedpublic void removeCommand(Command cmd)
cmd
- the Form command to be removedpublic void scrollComponentToVisible(Component c)
scrollComponentToVisible
in class Container
c
- the component to be visiblepublic void setMenuCellRenderer(ListCellRenderer menuCellRenderer)
menuCellRenderer
- the menu cell rendererpublic void removeAllCommands()
public void paint(Graphics g)
paint
in interface Animation
paint
in class Container
g
- the component graphicspublic void setScrollable(boolean scrollable)
setScrollable
in class Container
scrollable
- whether the component should/could scroll on the
X and Y axispublic void setVisible(boolean visible)
setVisible
in class Component
visible
- true if component is visible; otherwise falsepublic Color getTintColor()
setTintColor(java.awt.Color)
public void setTintColor(Color tintColor)
tintColor
- the tint color when a dialog or a menu is showngetTintColor()
public void setMenuTransitions(Transition transitionIn, Transition transitionOut)
transitionIn
- the transition that will play when the menu appearstransitionOut
- the transition that will play when the menu is foldedprotected void onShow()
protected void sizeChanged(int w, int h)
w
- the new width of the Formh
- the new height of the Formprotected void hideNotify()
protected void showNotify()
protected Command showMenuDialog(Dialog menu)
menu
- a dialog containing menu options that can be customized
|
Java DTV API 1.3 18-Nov-2009 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |