WorksheetsJava GUI
Total questions: 15
Worksheet time: 8mins
A JFrame is a descendant of each of the following classes except the ________class.
Component
Jar
Container
Window
The statement JFrame myFrame = new JFrame(); creates a JFrame that is _______.
invisible and has no title
invisible and has a title
visible and has no title
visible and has a title
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?
label1.add(frame1);
frame1.add(label1);
this.add(label1);
two of the above
Fill in the blanks so that this program displays a Frame. (Separate each answer with a space)
(a)
Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfield etc?
(a)
The package used for using graphical classes is
awt
util
lang
The basic container for java graphical programs is
Panel
Button
Frame
Window created in a java program can be made to show using the method
display()
setVisible()
focus()
How would you change the text of a label to the text contained by an integer named num;
label.setText(num);
label.updateText(num);
label.setTest("num");
label.setText(num+ "");
What object type handles Java's layouts?
Layout Manager
Layout Scheduler
Layout Operator
Layout Director
Which of one of the following package does not contain GUI components?
java.applet
java.awt
javax.swing
java.io
What method sets the size of the displayed JFrame?
setSize( int width, int height)
setSize( int height, int width)
setVisible( int width, int height)
setVisible( int height, int width)
How is a GUI component (such as a button) placed into a JFrame?
insert( Component c )
add( Component c)
draw( Component c )
put( Component c )
Which of the following is not one of the BorderLayout index?
Which layout arranges components in rows?
(a)
