Introduction to OOP Chapter 22: The AWT and Swing : next previous audio real text

Buttons, Sliders, Text Boxes, and so on

Graphical components (Buttons, Sliders, Text Boxes, and many many more) are provided in the standard library.

The user places an instance of a class into the window. Most use the listener event model to notify when they are changed.

	Button butn = new Button ("do it!");
	add("North", butn); // place at top of screen
	butn.addActionListener (new doIt()); // add listener
	private class doIt implements ActionListener {
		public void actionPerformed (ActionEvent e) {
			// what ever do it does
The listener model avoids the need for inheritance from the component class.
Intro OOP, Chapter 22, Slide 09