Chp 8 - Graphical User Interface ( GUI ) Flashcards

(30 cards)

1
Q

What is a GUI?

A

Graphical windows providing user interaction, accepting keyboard and mouse input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Name common GUI components.

A
  1. Buttons
  2. Labels
  3. Text fields
  4. Check boxes
  5. Radio buttons
  6. Combo boxes
  7. Sliders
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is AWT?

A

Abstract Window Toolkit: Java classes for graphics and GUIs; native component consistency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

AWT limitation?

A
  1. Offers only components common across OSs
  2. Limited extensibility
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is Swing?

A

Library of Java classes (JFC) providing richer, extensible GUI components.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Swing advantages?

A
  1. Consistent look across OSs
  2. Pedictable behavior
  3. Easily extended components
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is event-driven programming?

A

Programs react to events like button clicks; control driven by events.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is an event listener?

A

Object executing methods automatically when specific events occur.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to import Java Swing?

A

import javax.swing.*;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to import Java AWT

A

import java.awt.*

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are Container and Component?

A

Component is a GUI element; Container holds components or other containers.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How to create a Swing window?

A

Create a JFrame, add components to its content pane, show frame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a top-level container class?

A

JFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How to create a window by inheritance?

A

Extend JFrame and set up UI in constructor.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Three fundamental Swing components?

A
  1. JLabel
  2. JTextField
  3. JButton
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does Swing Components begins with?

17
Q

What is JLabel?

A

Displays text

18
Q

What is JTextField?

A

Single-line user input area

19
Q

What is JButton?

A

Clickable button triggering actions

20
Q

What is JPanel?

A

Container to group related components; panels added to content pane

21
Q

What is an event object?

A

Object containing information about an event; created by source component

22
Q

What interface must an action listener implement?

A

ActionListener with method actionPerformed(ActionEvent e)

23
Q

How to register an action listener?

A

Call component.addActionListener(listener)

24
Q

Name two ActionEvent methods.

A
  1. getSource()
  2. getActionCommand()
25
How to create a radio button?
1. new JRadioButton(String) 2. new JRadioButton(String, boolean selected)
26
How to group radio buttons?
Use ButtonGroup to make selection mutually exclusive
27
Are ButtonGroup containers?
No; not containers. Add buttons to panels separately
28
How to create a JCheckBox?
1. new JCheckBox(String) 2. new JCheckBox(String, boolean selected).
29
What event does JCheckBox generate?
ItemEvent when selected or deselected
30
What must an item listener implement?
ItemListener with method itemStateChanged(ItemEvent e)