Category Archive for: Using AWT Controls

Extending Button

Extending Button The following program creates an applet that displays a button labeled Test Button When .the button is pressed, the string “action event: “is displayed on the status line 01 the applet viewer or browser, followed by a count of the number of button presses. The program has one top-level class named Button Dem02 that extends…

Read More →

Components

Components  Before concluding at the AWT, one more topic needs to be discussed: handling events by extending components. The delegation event model was introduced in Chapter 20, and all of the programs in this book so far have used that design. But Java also allows you to handle events by  AWT components. Doing so allows you to handle events…

Read More →

Using List

Using List The List class provides a compact, multiple-choice, scrolling selection list. Unlike the . Choice object, which shows only the single selected item in the menu, a List object can be constructed to show any number of choices in the visible window. It can also be created to allow multiple selections. List provides these constructors.  List( )…

Read More →

Applying Check Boxes

Applying Check Boxes A check box is a control that is used to-turn an option on or off. It consists of a small box that can either contain a check mark or not. There is a label associated with each check box that describes what option the box represents -,You change the state of a check box, by…

Read More →

Responding to Controls

Responding to Controls Except for labels, which are passive controls, all controls generate events when they are accessed by the user. For example, when the user clicks on a push button, an eve  that identifies the push button. In general,  simply implements the •appropriate interface and then registers an event listener for each control that you need to…

Read More →

Back to Top