8 - Graphical User Interface (GUI) Applications

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/18

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

AWT

  • Single Windowing Interface on Multiple Platforms

  • Supports functions common to all window systems

  • Uses Underlying Native Window system

2
New cards

Abstract Windowing Toolkit

What does AWT stand for?

3
New cards
  • GUI widgets

  • Event Handling

  • Containers for widgets

  • Layout managers

  • Graphic operations

AWT provides…

4
New cards

Portable GUI

preserves native look and feel

5
New cards

Standard GUI Components

Buttons, menus, checkboxes, etc.

6
New cards

Containers

Panels, Frames, Designs

7
New cards

BorderLayout, GridLayout, FlowLayout, Null layout

Layouts responsible for actual positioning of components:

8
New cards
term image

What do adding components via the BoarderLayout look like?

9
New cards
term image

What do adding components via the GridLayout look like?

10
New cards
term image

What do adding components via the FlowLayout look like?

11
New cards
term image

What do adding components via the Null Layout look like?

12
New cards
  1. import java.awt.*;

    • Assemble the GUI

    • use GUI components, 

  2. basic components (e.g., Button, TextField)

  3. containers (Frame, Panel)

    • set the positioning of the components

  4. use Layout Managers

  5. Attach events

Steps to building Graphical User Interfaces

13
New cards
term image

What is the output of the following?

import java.awt.*;
public class MyGui 
{
	public static void main(String args[] ) 
	{ 
		Frame f = new  Frame ("My Frame");
		Button b = new Button("OK");
		TextField tf = new TextField("Programming in Java", 20);
		f.setLayout(new FlowLayout());
		f.add(b);
		f.add(tf);
		f.setSize(300, 300);
		f.setVisible(true);
	}
}

14
New cards

Listener

Each GUI component (e.g., a Button) that wishes to respond to an event type (e.g., click), must register an event handler, called a?

15
New cards

an object of a "Listener" interface.

The listener is an object of?

16
New cards

A Listener class can be created by subclassing (through "implements") one of Listener interfaces (all listener inrefaces are in the java.awt.event package = > must import java.awt.event.*; )

A Listener class can be created by?

17
New cards

The registration of the listener is done by a call to a method such as:

addActionListener(<Listener Object>).

How to register the listener?

18
New cards

[1] ActionListener

[2] ItemListener

[3] MouseMotionListener

[4] MouseListener

[5] KeyListener

[6] FocusListener

[7] AdjustmentListener

[8] ComponentListener

[9] WindowListener

[10] ContainerListener

[11] TextListener

Listener Interfaces in java.awt.event.*

19
New cards

Each listener interface has methods that need to be implemented for handling different kinds of events.

How do you handle different kinds of events and listeners?