Test your Java GUI programming skills with these comprehensive multiple-choice questions on Java Swing and AWT. Learn the fundamentals of creating graphical user interfaces in Java and prepare for exams or interviews
Which of the following is/are correct regarding events in Java?
a. EventObject is super class of all the events.
b. AdjustmentEvent will be notified if scroll bar is manipulated.
c. All the classes and methods required for even handling in Java is in java.io package.
d. getID( ) method can be used to determine the name of an event.
Answer
a. EventObject is super class of all the events.,b. AdjustmentEvent will be notified if scroll bar is manipulated.
EventObject class is a super class of all the events and is defined in java.util package. AdjustmentEvent is generated when a scroll bar is manipulated. All the classes and methods required for even handling in Java is in java.awt package. The method getID( )is used to determine the type of event.
Which of the following classes is used to display a message dialog in Java Swing?
a. JOptionPaneb. JDialog
c. JMessageDialog
d. JFrame
Answer
a. JOptionPane
JOptionPane is used to display a message dialog in Java Swing.
Which of the following event is occurred when a button is pressed, a list item is double- clicked or a menu item is selected?
a. AdjustmentEvent
b. ActionEvent
c. ContainerEvent
d. ComponentEvent
Answer
b. ActionEvent
ActionEvent is generated when a button is pressed, a list item is double-clicked or a menu item is
selected.
Which of the statements are correct about Swing programming?
a. AWT is a heavyweight programming.b. Swing is heavyweight programming.
c. Swing is lightweight programming.
d. Both AWT and Swing are lightweight programming.
Answer
c. Swing is lightweight programming.
Swing is lightweight programming.
0 Comments