EasyManua.ls Logo

Motorola T720 - Page 51

Motorola T720
57 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Coding Example
51
} // 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:
// b2.setVisible(false);
This makes the second button invisible.
Step 2: Disable a button.
For the fourth button, b4, uncomment the statement
// b4.setEnabled(false);
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.

Other manuals for Motorola T720

Related product manuals