12 Questions
Which Java Swing component is used to display text?
JLabel
What is the method used in JFrame to set the title of the frame?
setTitle(String a)
Which Java Swing container is commonly used to store a group of components?
JPanel
What does the method setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE) do in JFrame?
Close the frame
Which Java Swing component allows user input?
JTextField
What is the purpose of Java Swing?
Create window-based applications or GUI applications
Which method is used to set the text on a Java JLabel?
setText(String s)
What method is used to enable or disable a Java JButton?
setEnabled(Boolean b)
Which method in JLabel is used to get the currently set image/icon?
getIcon()
In Java Swing, which method is used to add an action listener to a JButton?
addActionListener(this)
What does setVerticalAlignment(SwingConstants.) allow you to control in a Java JLabel?
Vertical position of the label text
Which Java Swing component allows the editing of a single line of text?
JTextField
Test your knowledge on Java Swing components such as JFrame, JPanel, JLabel, and JButton. Learn about creating window-based applications and GUI applications using Java Swing. Understand the differences between Java Swing and AWT.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free