O'Reilly logo

LWUIT 1.1 for Java ME Developers by Biswajit Sarkar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The Button class

The Button extends Label. Therefore, it inherits the characteristics of a label. In addition, Button has distinct capabilities of its own like these:

  • It is able to sense and respond to user actions
  • It can receive focus
  • It has internal states—Default, Rollover, and Pressed

Like labels, buttons too are widely used, not only as standalone widgets, but also to build up other more complex components. Whenever we need to create an entity to display text, icon, or both and to be able to respond to key or pointer actions, buttons are very likely to be used. As we have seen in Chapter 3, each individual tab of a tabbed pane is actually a button.

Creating a Button

The Button class has five constructors, of which three are just like those of the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required