Modify A Button's Location - Motorola T720 Developer's Manual

Hide thumbs Also See for T720:
Table of Contents

Advertisement

Figure 21.
Step 4: Watch the change of focus ownership.
Use the navigation button to traverse the focus among the enabled buttons. You'll see
that only two of the buttons receive focus ownership: the first button b1, and the second
round button, b5.
There are several other statements in the ButtonDemo constructor that you can
uncomment to disable other buttons or make them invisible. Feel free to experiment with
those and see what happens.
Now let's see what effect an LWT component's offset scheme can have on the MIDlet's UI
layout.

Modify a Button's Location

You can specify the screen location of an LWT component using one of several schemes.
You can position the component using offsets from a screen location (top, left, right, or
center). For example, the second button's right edge was set to coincide with the right of
the screen by supplying the setRightEdge() method with arguments of a
SCREEN_RIGHT constant and an offset of zero.
Alternatively, components can be located offset relative to other components. The LWT
provides an extensive suite of relative offset schemes, where a component can be offset
from another component's right edge, left edge, horizontal center, top edge, bottom edge,
or vertical center. Consult the Lightweight Window Toolkit Programmer's Guide for further
information on these offset schemes.
By default, the LWT aligns a component adjacent to the left edge of the screen and under
the previous component. This is what the MIDlet's current layout shows. Let's change an
offset scheme or two and see what happens.
52
The screen after the second button was made invisible and the fourth
button is disabled.

Advertisement

Table of Contents
loading

Table of Contents