|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.j4me.ui.DeviceScreen
org.j4me.ui.Dialog
public abstract class Dialog
The Dialog
class is a base class for any screen that accepts user input
using standard components like the text box. It is similar to the MIDP Form
class
except that it uses the J4ME control flow and has an OK and Cancel button built in.
Form classes can only have component objects, like the text box or label, placed on them.
The class handles layout, painting, and management of the components.
If you need direct control over the appearance of the screen use the DeviceScreen
class.
Form
Field Summary |
---|
Fields inherited from class org.j4me.ui.DeviceScreen |
---|
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, MENU_LEFT, MENU_RIGHT, RIGHT, UP |
Constructor Summary | |
---|---|
Dialog()
Implicitly called by derived classes to setup a new J4ME form. |
Method Summary | |
---|---|
void |
append(Component component)
Adds the component to the end of this form. |
java.util.Enumeration |
components()
Returns an enumeration of the components on this form. |
void |
delete(Component component)
Removes the first occurrence of the component from this form. |
void |
delete(int index)
Deletes the component at the specified index . |
void |
deleteAll()
Removes all of the components from this form. |
Component |
get(int index)
Returns the component at the specified index. |
int |
getMargin()
Returns the margin for the left and right of the screen. |
int |
getSelected()
Returns the index of the currently selected component. |
int |
getSpacing()
Returns the vertical spacing between components. |
int |
getWidth()
Returns the width of the usuable portion of this form. |
boolean |
hasVerticalScrollbar()
Determines if the height of all the components is greater than the height of the screen. |
void |
hideNotify()
Called immediately before this screen is replaced by another screen. |
void |
insert(Component component,
int index)
Inserts the component in this form at the specified index . |
void |
invalidate()
Forces the layout of all components to be recalculated. |
protected void |
keyPressed(int keyCode)
Called when a key is pressed. |
protected void |
keyReleased(int keyCode)
Called when a key is released. |
protected void |
keyRepeated(int keyCode)
Called when a key is repeated (held down). |
protected void |
paint(javax.microedition.lcdui.Graphics g)
Paints the form and its components. |
protected void |
paintVerticalScrollbar(javax.microedition.lcdui.Graphics g,
int x,
int y,
int width,
int height,
int offset,
int formHeight)
Paints the vertical scrollbar. |
protected void |
pointerDragged(int x,
int y)
Called when the pointer is dragged. |
protected void |
pointerPressed(int x,
int y)
Called when the pointer is pressed. |
protected void |
pointerReleased(int x,
int y)
Called when the pointer is released. |
void |
set(Component component,
int index)
Sets the component in this form at the specified index . |
void |
setFullScreenMode(boolean mode)
Shows or hides the menu bar at the bottom of the screen. |
void |
setMargin(int margin)
Sets the margin for the left and right of the screen. |
void |
setMenuText(java.lang.String left,
java.lang.String right)
Sets the menu bar text. |
void |
setSelected(Component component)
Sets the selected component. |
void |
setSelected(int index)
Sets the selected component. |
void |
setSpacing(int spacing)
Sets the vertical spacing between components. |
void |
setTitle(java.lang.String title)
Sets the title of this screen. |
int |
size()
Returns the number of components on this form. |
Methods inherited from class org.j4me.ui.DeviceScreen |
---|
acceptNotify, declineNotify, getCanvas, getHeight, getLeftMenuText, getRightMenuText, getScreenHeight, getScreenWidth, getTitle, hasMenuBar, hasTitleBar, intersects, isFullScreenMode, isShown, paintBackground, paintMenuBar, paintTitleBar, repaint, repaint, serviceRepaints, show, showNotify, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Dialog()
Method Detail |
---|
public void hideNotify()
Notifies all the components they are hidden. Classes that override
this method should be sure to call super.onDeselection
.
hideNotify
in class DeviceScreen
DeviceScreen.hideNotify()
public void append(Component component)
component
to the end of this form.
component
- is the UI component to add to the bottom of the form.public void insert(Component component, int index)
component
in this form at the specified index
.
Each component on this form with an index greater or equal to the
specified index
is shifted upward to have an index one greater
than the value it had previously.
component
- is the UI component to insert.index
- is where to insert component
on the form. It must
greater than or equal to 0 and less than or equal to the number of
components already on the form.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public void set(Component component, int index)
component
in this form at the specified index
.
The previous component at that position is discarded.
component
- is the UI component to set to.index
- is where to set component
on the form. It must
greater than or equal to 0 and less than the number of
components already on the form.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public void delete(Component component)
component
from this form.
If component
is found on this form, each component on the form
with an index greater or equal to the component
's index is
shifted downward to have an index one smaller than the value it had
previously.
component
- is the UI component to remove.public void delete(int index)
component
at the specified index
. Each
component in this vector with an index greater or equal to the
specified index is shifted downward to have an index one smaller
than the value it had previously.
index
- is the index of the component to remove. It must be
a value greater than or equal to 0 and less than the current
number of components on the form.
java.lang.ArrayIndexOutOfBoundsException
- if the index was invalid.public void deleteAll()
public java.util.Enumeration components()
public int size()
public Component get(int index)
index
- is the value into the component list to get.
index
or null
if the
index is invalid.public int getSelected()
public void setSelected(int index)
index
- is the new selected component.public void setSelected(Component component)
component
- is the new selected component. If it is not
on the form this has no effect.protected void paint(javax.microedition.lcdui.Graphics g)
paint
in class DeviceScreen
g
- is the Graphics
object to paint with.DeviceScreen.paintBackground(Graphics)
protected void paintVerticalScrollbar(javax.microedition.lcdui.Graphics g, int x, int y, int width, int height, int offset, int formHeight)
g
- is the Graphics
object to paint with.x
- is the top-left X-coordinate pixel of the form area.y
- is the top-left Y-coordinate pixel of the form area.width
- is the width of the form area in pixels.height
- is the height of the form area in pixels.offset
- is the vertical scrolling position of the top pixel
to show on the form area.formHeight
- is the total height of all the components on the
form. This is bigger than height
.public int getMargin()
public void setMargin(int margin)
margin
- is the number of pixels between components and
the edges of the screen. Values less than 0 are ignored.public int getSpacing()
public void setSpacing(int spacing)
spacing
- is the number of pixels that vertically separates
components. Values less than 0 are be ignored.public int getWidth()
getWidth
in class DeviceScreen
public boolean hasVerticalScrollbar()
true
if the form has a vertical scrollbar and false
if it does not.public void invalidate()
public void setFullScreenMode(boolean mode)
setFullScreenMode
in class DeviceScreen
mode
- is true
if the DeviceScreen
is to be in full
screen mode, false
otherwise.public void setMenuText(java.lang.String left, java.lang.String right)
For the menu to be visible full screen mode must be off.
This can be done with the setFullScreenMode
method.
setMenuText
in class DeviceScreen
left
- is the text for the negative menu option or null
to remove the button. Negative menu options are things like canceling
a form and moving back to a previous screen.right
- is the text for the positive menu option or null
to remove the button. Positive menu options are things like accepting
a form, advancing to the next screen, or displaying a menu.DeviceScreen.declineNotify()
,
DeviceScreen.acceptNotify()
public void setTitle(java.lang.String title)
null
meaning no
title.
For the title to be visible full screen mode must be off.
This can be done with the setFullScreenMode
method.
setTitle
in class DeviceScreen
title
- is the new title for the screen.protected void keyPressed(int keyCode)
keyPressed
in class DeviceScreen
keyCode
- is the key code of the key that was pressed.protected void keyRepeated(int keyCode)
keyRepeated
in class DeviceScreen
keyCode
- is the key code of the key that was held down.protected void keyReleased(int keyCode)
keyReleased
in class DeviceScreen
keyCode
- is the key code of the key that was released.protected void pointerPressed(int x, int y)
pointerPressed
in class DeviceScreen
x
- is the horizontal location where the pointer was pressed.y
- is the vertical location where the pointer was pressed.protected void pointerDragged(int x, int y)
pointerDragged
in class DeviceScreen
x
- is the horizontal location where the pointer was dragged.y
- is the vertical location where the pointer was dragged.protected void pointerReleased(int x, int y)
pointerReleased
in class DeviceScreen
x
- is the horizontal location where the pointer was released.y
- is the vertical location where the pointer was released.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |