Test 1 Java Swings
This quiz tests knowledge of Java Swing GUI framework including components, event handling, imports, and layout management.
Questions
Which of the following classes in Java contains swing version of an applet?
- JButton
- JCheckBox
- JApplet
- AbstractButton
- JLabel
Which of the following statements is must in a Java program for creating a frame?
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.frame;
- 1, 2 and 3
- only 1 and 2
Which of the following align arguments is not available in Java to be used in SwingConstants interface?
- Left
- Right
- Middle
- Leading
- Trailing
Which of the following classes of Java swing extends Applet class?
- JButton
- JApplet
- AbstractButton
- None of these
In Java swing, which of the following components is/are represented by a rectangular area in which a component may be viewed?
- Scroll pane
- Tabbed pane
- Combo boxes
- None of these
Which of the following classes in java.awt package describes a graphics device such as a screen or printer?
- Canvas
- GraphicsDevice
- Frame
- None of these
What is not true for a Java bean?
- There are no public instance variables.
- All persistent values are accessed using getxxx and setxxx methods.
- It may have many constructors as necessary.
- All of the above are true of a Java bean.
Which component of an event is the object that generates the event?
- Event object
- Event source
- Event handler
- None of these
_________ is generated when a button is pressed, a list item is double-clicked or a menu item is selected.
- Action Event
- Adjustment Event
- Component Event
- Container Event
Which of the following events is generated when the size, position or visibility of a component is changed?
- Adjustment Event
- Component Event
- Container Event
- Item Event
To create swing components, which of the following is imported?
- javax.awt.*
- java.awt.*
- javax.swing.*
- java.swing.*
Which event is generated when a checkbox or a list item is clicked or when a check menu item is selected or deselected?
- Container Event
- Component Event
- Focus Event
- Item Event
Swing elements are preceded by the letter
- S
- A
- X
- J
Which of the following user interfaces defines how should components be arranged in a container?
- Component
- Container
- Layout manager
- None of these