Java Swing Components Quiz
12 Questions
3 Views
3.6 Stars

Java Swing Components Quiz

Created by
@FluentHyena

Questions and Answers

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?

<p>Close the frame</p> Signup and view all the answers

Which Java Swing component allows user input?

<p>JTextField</p> Signup and view all the answers

What is the purpose of Java Swing?

<p>Create window-based applications or GUI applications</p> Signup and view all the answers

Which method is used to set the text on a Java JLabel?

<p>setText(String s)</p> Signup and view all the answers

What method is used to enable or disable a Java JButton?

<p>setEnabled(Boolean b)</p> Signup and view all the answers

Which method in JLabel is used to get the currently set image/icon?

<p>getIcon()</p> Signup and view all the answers

In Java Swing, which method is used to add an action listener to a JButton?

<p>addActionListener(this)</p> Signup and view all the answers

What does setVerticalAlignment(SwingConstants.) allow you to control in a Java JLabel?

<p>Vertical position of the label text</p> Signup and view all the answers

Which Java Swing component allows the editing of a single line of text?

<p>JTextField</p> Signup and view all the answers

More Quizzes Like This

Java Swing Components Quiz
5 questions

Java Swing Components Quiz

GuiltlessMossAgate6560 avatar
GuiltlessMossAgate6560
Java Swing Tutorial
11 questions
Java Swing GUI Overview
0 questions

Java Swing GUI Overview

BeneficentColumbus avatar
BeneficentColumbus
Use Quizgecko on...
Browser
Browser