wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Java GUI

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

A JFrame is a descendant of each of the following classes except the ________class.

a)

Component

b)

Jar

c)

Container

d)

Window

2.

The statement JFrame myFrame = new JFrame(); creates a JFrame that is _______.

a)

invisible and has no title

b)

invisible and has a title

c)

visible and has no title

d)

visible and has a title

3.

Suppose that you create an application in which you instantiate a JFrame named frame1 and a JLabel named label1. Which of the following statements within the application adds label1 to frame1?

a)

label1.add(frame1);

b)

frame1.add(label1);

c)

this.add(label1);

d)

two of the above

4.

Fill in the blanks so that this program displays a Frame. (Separate each answer with a space)



(a)  

5.

Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfield etc?

(a)  

6.

The package used for using graphical classes is

a)

awt

b)

util

c)

lang

7.

The basic container for java graphical programs is

a)

Panel

b)

Button

c)

Frame

8.

Window created in a java program can be made to show using the method

a)

display()

b)

setVisible()

c)

focus()

9.

How would you change the text of a label to the text contained by an integer named num;

a)

label.setText(num);

b)

label.updateText(num);

c)

label.setTest("num");

d)

label.setText(num+ "");

10.

What object type handles Java's layouts?

a)

Layout Manager

b)

Layout Scheduler

c)

Layout Operator

d)

Layout Director

11.

Which of one of the following package does not contain GUI components?

a)

java.applet

b)

java.awt

c)

javax.swing

d)

java.io

12.

What method sets the size of the displayed JFrame?

a)

setSize( int width, int height)

b)

setSize( int height, int width)

c)

setVisible( int width, int height)

d)

setVisible( int height, int width)

13.

How is a GUI component (such as a button) placed into a JFrame?

a)

insert( Component c )

b)

add( Component c)

c)

draw( Component c )

d)

put( Component c )

14.

Which of the following is not one of the BorderLayout index?

b)

BorderLayout.EAST

c)

BorderLayout.SOUTHEAST

d)

BorderLayout.NORTH

15.

Which layout arranges components in rows?

(a)