0% found this document useful (0 votes)
91 views

GUI Questions

Event-driven programming involves writing programs that respond to user actions like button clicks and menu selections in the order the user performs them. [1] GUI programs are usually written using toolkits that provide software components, like the Abstract Windowing Toolkit (AWT) used in this chapter. [2] The three main parts of a GUI program are GUI components, event listeners, and application code. [3] Nearly all GUI programs will have a frame component. [4] A container is an object like a frame that can hold other GUI components inside of it. [5-8] The paint() method is called by the system whenever it needs to display the frame. [9] A Graphics object represents the part of

Uploaded by

TEGEGN
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
91 views

GUI Questions

Event-driven programming involves writing programs that respond to user actions like button clicks and menu selections in the order the user performs them. [1] GUI programs are usually written using toolkits that provide software components, like the Abstract Windowing Toolkit (AWT) used in this chapter. [2] The three main parts of a GUI program are GUI components, event listeners, and application code. [3] Nearly all GUI programs will have a frame component. [4] A container is an object like a frame that can hold other GUI components inside of it. [5-8] The paint() method is called by the system whenever it needs to display the frame. [9] A Graphics object represents the part of

Uploaded by

TEGEGN
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

What is it called when a program is written to respond to the button clicks, menu
selections, and other actions of the user in whatever order the user does them?
a. Event-driven programming.
b. Action-driven programming.
c. User-driven programming.
d. Mouse-driven programming
A

2. Usually GUI programs are written by using existing software components provided
in a toolkit. The Java toolkit used in this chapter is the:
a. GUI toolkit
b. Abstract Windowing Toolkit
c. Graphics Event Toolkit
d. Java Enhancement Toolkit
B

3. The three software parts of a GUI program are:


a. Windows, Buttons, Mice
b. GUI Components, Graphics, Code
c. GUI Components, Event Listeners, Application Code
d. Frames, Code, Events
C

4. What is the one component that nearly all GUI programs will have?
a. Frame
b. Mouse
c. Monitor
d. Button
A

5. What is a container object in GUI programming?


a. A container is another name for an array or vector.
b. A container is any class that is made up of other classes.
c. A container is a primitive variable that contains the actual data.
d. A container is an object like a Frame that has other GUI components placed inside of it.
D

6. Fill in the blanks so that this program displays a Frame:


import java.awt.*;

public class microGUI


{
public static void main ( String[] args )
{
Frame frm = new ___________();
frm.___________( 150, 100 );
frm.___________( true );
}
}

a. Form, setVisible, setOn


b. Frame, setSize, setVisible
c. Frame, setVisible, setSize
d. Window, setSize, paint
B

7. Which of the following sets the frame to 300 pixels wide by 200 high?
a. frm.setSize( 300, 200 );

b. frm.setSize( 200, 300 );

c. frm.paint( 300, 200 );

d. frm.setVisible( 300, 200 );


A

8. Fill in the blanks so that the following draws a Frame containing "Hello".
import java.awt.*;

class helloFrame ___________ Frame


{
public void ___________( Graphics g )
{
g.___________("Hello", 10, 50 );
}
}

public class Tester


{
public static void main ( String[] args )
{
helloFrame frm = new helloFrame();
frm.setSize( 150, 100 );
frm.setVisible( true );
}
}

a. import, drawString, paint


b. extends, paint, drawString
c. extends, draw, paint
d. include, drawString, paint
B

9. When is the paint() method of a frame object called?


a. The user calls it to display the frame.
b. The main() method calls it once when the program starts.
c. The Java system calls it every time it decides to display the frame.
d. The Java system calls it once when the program starts.
C

10. What is a Graphics object?


a. The Graphics object represents the part of the Frame that you can draw on.
b. The Graphics object represents the whole Frame.
c. The Graphics object represents the entire monitor.
d. The Graphics object represents the graphics board.
A

You might also like