WorksheetsGUI Quiz
Total questions: 10
Worksheet time: 5mins
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
When a user closes a JFrame, the default behavior is for ______.
the JFrame to close and the application to keep running
the JFrame to be hidden and the application to keep running
the JFrame to close and the application to exit
nothing to happen
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
A JFrame contains a JButton named button1 that should execute an actionPerformed() method when clicked. Which statement is needed in the JFrame class?
addActionListener(this);
addActionListener(button1);
button1.addActionListener(this);
this.addActionListener(button1);
Events in Java are objects that are created by Event Sources (such as JButtons, JPanels, and other Components).
True
False
The three software parts of a GUI program are:
Windows, Buttons, Mice
GUI Components, Graphics, Code
GUI Components, Event Listeners, Application Code
Frames, Code, Events
Fill in the blanks so that this program displays a Frame:
Form, setVisible, setOn
Frame, setSize, setVisible
Frame, setVisible, setSize
Window, setSize, paint
Which is the container that doesn't contain title bar and MenuBars but it can have other components like button, textfield etc?
Window
Frame
Panel
Container
The Java Foundation Classes (JFC) is a set of GUI components which simplify the development of desktop applications.
True
False
