Intro to Gui and Swing Flashcards

1
Q

Layout Manager

A
  1. Asks components for their preferred size, before making a decision about the layout
  2. Control the size and location of components nested within other components
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Component

A

A correct term for what we’ve been calling a widget. The things you put in a GUI. The things a user sees and interacts with

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

Border layout

A
  1. The default layout manager for a frame

2. Let’s you add a component to one of five regions

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

Flow layout

A
  1. The default layout manager for a panel
  2. Gives components their preferred size in both dimensions
  3. Places components left to right, top to bottom, in the order they were added
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Box layout

A
  1. The default layout manager for a frame

2. Let’s you align components stacked vertically, even if they could fit side-by-side

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

background component

A
  1. When you add a component to another component

2. The added component is controlled by the layout manager of the background component

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

How come you can’t add directly to a frame the way you can to a panel?

A

A JFrame is special because it’s where the rubber meets the road in making something appear on the screen

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

What if I want a different preferred size? Is there a setSize() method for components?

A

Yes, there is a setSize(), but the layout manager will ignore it

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

Can I turn the layout managers off?

A

Yes. On a component by component basis, you can call setLayout(null)

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

setLayout()

A

To allow a panel to use something other than flow

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

JTextArea

A

Input more than one line of text

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

JFrame

A

The object that represents a window on the screen. It’s where you put all the interface things like buttons, checkboxes, text fields, and so on

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

Will a button look like a Windows button when you run on Windows?

A

If you want it to. The standard Java look and feel, also known as Metal, and the native look and feel for your platform

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

Event-handling

A

The process of getting and handling a user event

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

Listener interface

A

The bridge between the listener and event source

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

Swing GUI components

A

Event sources

17
Q

Event sources

A
  1. An object that can turn user actions into events

2. Creates event object when the user does something that matters

18
Q

Listener

A

To implement the interface, register with the button, and provide the event-handling

19
Q

Event source (Job)

A

To accept registrations from listener, get events from the user

20
Q

Inner class

A
  1. Gets to use those variables and methods just as if the methods and variables were declared within the inner class
  2. Inner object shares a special bond with an outer object