Roundbutton Class Code Tour - Motorola T720 Developer's Manual

Hide thumbs Also See for T720:
Table of Contents

Advertisement

Figure 20.
Observe how the screen has automatically scrolled to fully display the second button. This
vertical scrolling is a feature provided by the LWT. If you press the down arrow on the
navigation button again, the focus jumps back to the topmost button on the screen. The
screen also scrolls back up to the top, so that you're looking at a screen that resembles
Figure 17. Try using both the up and down arrows to move the focus ownership among
the various buttons.
NOTE: The LWT reserves the vertical scrollbar to maneuver through the visible screen
components. You use horizontal scrollbars to implement sliders. However, you can extend
the LWT's components to process up, down, left, and right key events. You would do this
to implement a game or a special-purpose vertical market application.
Press the Exit soft key to quit the MIDlet and terminate the debugger session.

RoundButton Class Code Tour

Now that you understand how LWT components handle focus ownership and provide
desktop-quality visual feedback in response to events, let's take a tour of the code that
makes use of the Button class to implement the RoundButton class. The RoundButton
code shows you how easy it is to extend an LWT component. Start by double-clicking on
the file Buttons.java in the Project window to open the file in the editor.
import java.io.*;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
import com.motorola.lwt.*;
// The RoundButton class. Draws a round LWT button.
// Inherits the rest of its capabilities (such as
// key events) from the Button class.
44
The second round button has focus ownership. Note that the screen has
scrolled.

Advertisement

Table of Contents
loading

Table of Contents