"Java MobilePDA Program Design" Reading Note 6 - LCDAUI Advanced API FORM and ITEM

xiaoxiao2021-03-06  15

FORM is a container type, adding a wide variety of Item subclasses on the Form, forming a rich picture.

Form and other procedures:

Left (item.Layout_left)

Item.Layout_center

Leaning on right (item.Layout_Right)

SetLayout () Set / getLayout Get

Each Item has a Label property, setting to NULL representative Don't label. Getlabel () / setLabel ()

Item actual display size:

Minimum size (minimum size): at least the size of the components required for at least SETMINIMHEIGHT () / getMinImumwidth ()

Preferred size: optimal size setpreferredsize () / getpreferredsize ()

SetPreferRedsize (50, -1) width lock is 50

SetPreferRedsize (-1, 5) height locks 5

ITEM type

StringItem

ImageItem

Choicegroup

Textfield

Gauge

Datefield

StringItem

A string of words displayed with buttons or hyperlinks

Display display;

Form f = new form ("stringItem Test");

StringItem Si1 = New StringItem ("Test1:", "Content1", Item.plain;

F.Append (Si1); // INSERT () // delete () // set ()

Dislplay.setcurrent (f);

Constructor:

Three parameters: Label, Content, Style - Select: Plain, Button, HyperLink

Two parameters: equivalent to using the appearance of the Plain.

GetAppearanceMode () is used to get the look of StringItem.

GetFont () / setFont () is used to get / set the font.

GetText () / setText () is used to get / set content

ItemCommandListener (Item and Command)

There will be at least three things of Item subclasses:

Command array;

DefaultCommand variables, reference to a Command in a Command array;

Point reference to ItemMandListener.

Increase the COMMAND array must rely on addcommand () / removecommand ()

Set the reference to ItemMandilistener to use setItemCommandListener ()

Setting the defaultcommand must use setDefaultCommand ().

When we add Item to FORM, the Command array of the selected item will become the system menu item.

After any menu items are selected, the CommandAction () method in the class of the ItemMandListener interface is implemented will be called.

Si.AddCommand (New Command ("1", Command.Item, 1);

Si.Addcommand (New Command ("2", Command.Item, 1);

Si.setItemCommandListener (this);

......

Public void CommandAction (Command C, Item I)

{

System.out.println (c.getlabel ());

System.out.println (i.getlabel ());

}

ImageItem

Constructor:

Five-Parameters: Label, Imaging, and other proof, replace text, appearance - PLAIN, Button, Hyperlink. Four parameters: equivalent appearance is Plain.

Wait line:

ImageItem.Layout_Default

ImageItem.Layout_Left

ImageItem.Layout_Right

ImageItem.Layout_Center

ImageItem.Layout_Newline_Before

ImageItem.Layout_Newline_AFTER

SetLayout () / getLayout () setting / get the right

SetImage () / getImage () setting / get image object

SetaltText () / getAltText () setting / get replacement text

GetappearanceMode () gets the look.

Spacer

Designed to add blank interval in Formshang.

Display display;

StringItem Si = New StringItem ("Test", "Content", Item.plain;

F.Append (Si);

F.Append (New SACER (50, 50));

Display.setcurrent (f);

Choicegroup

And the List class is very similar, they all achieve the Choice interface. Different, ChoiceGroup must be useful in Form. It only

Choice.exClusive Choice.multiple kice.popup does not use Choice.Implicit.

Textfield

Similar to the TextBox class.

Gauge

Rod, progress bar.

Constructor:

Volume label name, can you interact, allowed maximum, initial value

GetMaxValue () / setMaxValue () get / set maximum

GetValue () / setValue () get / set the initial value at the time

Isinteractive () judgment can be interactive

Whether you can interact with false, you can only use the setValue () set value.

Whether you can interact = false and the maximum value allowed = gauge.indefinite can generate an unwanted Gauge.

Initial value selection:

Gauge.Continuous_Idle.Continuous_Idle.Continuous_Idle.Continuous

Gauge.Continuous_Running

Gauge.incremenTal_Idle.Increme

Gauge.incremental_Updating

Gauge as a progress display:

Alert Al = New Alert ("Processing");

......

Gauge G = New Gauge (NULL, FALSE, 10, 0);

Al.Setindicator (G);

......

Datefield

Date time component

Constructor:

Volume sign, input mode (--Datefield.date/datefield.time/datefield.date_time) ,JVA.UTIL.Timezone object

getInputMode () / setInputMode () to get / change the input mode

GetDate () / setdate () get / set the time specified by the user

Date objects must be equipped with Java.util.Calendar class.

When the internal state of the user interface component placed inside the FORM component changes, the Form component issues a message to all the itemStateChanged () method in the class that it registers it registered with the itemStateEndener () method. ItemStateListener is only called only when the component status is really changed in the user interaction. If you want to automatically call ItemStateChanged (): After a component status changes, call Item's NotifyStateChanged (), and the program can call ItemStateChanged () and return to the original call. There is no need to wait for the itemStateChanged () end to return. When there is a CommandListener and ItemStateListener, iTemStateChanged () is called first than CommandAction ().

转载请注明原文地址:https://www.9cbs.com/read-45969.html

New Post(0)