Motorola T720 Developer's Manual page 51

Hide thumbs Also See for T720:
Table of Contents

Advertisement

Coding Example
} // end constructor
As the code shows, using an LWT button is straightforward. You use the new constructor
and then the add() method to add the button to a LWT ComponentScreen. (The
instance of a ComponentScreen is made in the class DemoScreen.) Making a
RoundButton is no different: you use its new constructor and add it to the
ComponentScreen. Finally, you assign each button a listener, even if it is disabled.
For the second button, note how the button's right edge field can be set to reach to the
right edge of the screen. (Component.SCREEN_RIGHT).
For the third button, observe that by using the method setEnabled() with an
argument of false, it disables the button.
Now, let's change things and see what happens.
Step 1: Modify a button's visibility.
For the second button, b2, uncomment the statement:
//
This makes the second button invisible.
Step 2: Disable a button.
For the fourth button, b4, uncomment the statement
//
This disables the fourth button.
Step 3: Run the program and observe the results.
Build the project (Project | Make) and run it under debugger control (Project | Debug).
Start the debugger, (Project | Run) and notice that changes. The phone simulator's screen
should resemble Figure 21.
b2.setVisible(false);
b4.setEnabled(false);
51

Advertisement

Table of Contents
loading

Table of Contents