Simple graphics with AWT and Swing Flashcards

1
Q

What is the purpose of the JFrame class in Java Swing?

a) To create a panel for drawing graphics
b) To create a window for displaying GUI components
c) To manage database connections
d) To handle HTTP requests

A

b) To create a window for displaying GUI components

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

What is the purpose of the JPanel class in Java Swing?

a) To create a window for displaying GUI components
b) To create a panel for drawing graphics and adding components
c) To manage database connections
d) To handle HTTP requests

A

b) To create a panel for drawing graphics and adding components

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

What is the purpose of the paintComponent method in Java Swing?

a) To create a new window
b) To define the layout of components
c) To draw graphics on a panel
d) To manage database connections

A

c) To draw graphics on a panel

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

What is the purpose of the Graphics2D class in Java AWT?

a) To create a new window
b) To provide advanced drawing capabilities
c) To manage database connections
d) To handle HTTP requests

A

b) To provide advanced drawing capabilities

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

What is the purpose of the setColor method in Java AWT?

a) To create a new window
b) To set the background color of a panel
c) To set the color for drawing operations
d) To manage database connections

A

c) To set the color for drawing operations

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

What is the purpose of the drawLine method in Java AWT?

a) To create a new window
b) To draw a line between two points
c) To manage database connections
d) To handle HTTP requests

A

b) To draw a line between two points

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

What is the purpose of the drawRect method in Java AWT?

a) To create a new window
b) To draw the outline of a rectangle
c) To manage database connections
d) To handle HTTP requests

A

b) To draw the outline of a rectangle

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

What is the purpose of the fillRect method in Java AWT?

a) To create a new window
b) To draw a filled rectangle
c) To manage database connections
d) To handle HTTP requests

A

b) To draw a filled rectangle

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

What is the purpose of the drawOval method in Java AWT?

a) To create a new window
b) To draw the outline of an oval
c) To manage database connections
d) To handle HTTP requests

A

b) To draw the outline of an oval

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

What is the purpose of the fillOval method in Java AWT?

a) To create a new window
b) To draw a filled oval
c) To manage database connections
d) To handle HTTP requests

A

b) To draw a filled oval

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

What is the purpose of the drawImage method in Java AWT?

a) To create a new window
b) To draw an image on a panel
c) To manage database connections
d) To handle HTTP requests

A

b) To draw an image on a panel

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

What is the purpose of the BufferedImage class in Java AWT?

a) To create a new window
b) To store and manipulate image data
c) To manage database connections
d) To handle HTTP requests

A

b) To store and manipulate image data

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

What is the purpose of the ImageIO class in Java?

a) To create a new window
b) To read and write image files
c) To manage database connections
d) To handle HTTP requests

A

b) To read and write image files

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

What is the purpose of the setPreferredSize method in Java Swing?

a) To create a new window
b) To set the preferred size of a component
c) To manage database connections
d) To handle HTTP requests

A

b) To set the preferred size of a component

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

What is the purpose of the setBackground method in Java Swing?

a) To create a new window
b) To set the background color of a component
c) To manage database connections
d) To handle HTTP requests

A

b) To set the background color of a component

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

What is the purpose of the setFocusable method in Java Swing?

a) To create a new window
b) To allow a component to receive focus
c) To manage database connections
d) To handle HTTP requests

A

b) To allow a component to receive focus

17
Q

What is the purpose of the pack method in Java Swing?

a) To create a new window
b) To resize the window to fit its contents
c) To manage database connections
d) To handle HTTP requests

A

b) To resize the window to fit its contents

18
Q

What is the purpose of the setVisible method in Java Swing?

a) To create a new window
b) To make a window visible or invisible
c) To manage database connections
d) To handle HTTP requests

A

b) To make a window visible or invisible

19
Q

What is the purpose of the Color class in Java AWT?

a) To create a new window
b) To define and manipulate colors
c) To manage database connections
d) To handle HTTP requests

A

b) To define and manipulate colors

20
Q

What is the purpose of the new Color(int r, int g, int b) constructor in Java AWT?

a) To create a new window
b) To define a custom color using RGB values
c) To manage database connections
d) To handle HTTP requests

A

b) To define a custom color using RGB values