Java: Swing Frames Trivia Quiz

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Kawiz711
K
Kawiz711
Community Contributor
Quizzes Created: 3 | Total Attempts: 5,763
| Attempts: 2,920 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Swing class which is used for frames, is

Explanation

The correct answer is JFrame. The Swing class is used for creating graphical user interface (GUI) components in Java. JFrame is a class that extends the Window class and provides functionalities for creating and managing frames, which are the main containers for GUI components in a Java application. Therefore, the correct answer is JFrame.

Submit
Please wait...
About This Quiz
Java: Swing Frames Trivia Quiz - Quiz

What do you know about Java? This is a quiz on Java Swing frames. Are you ready for this Java: Swing Frames Trivia Quiz. J Frames work as... see morethe main window where components like labels, buttons, and text fields get added to create a GUI. Unlike Frame, J Frame contains the option to hide or close the window through the set Default Close Operation(int) method. Let's see how well you know through this quiz. Best of luck to you!
see less

2. In what is the size of a frame on the screen measured?

Explanation

The size of a frame on the screen is measured in pixels. Pixels are the smallest unit of measurement on a screen and refer to the individual dots that make up an image. The more pixels there are in a frame, the higher the resolution and clarity of the image.

Submit
3. Fill in the blanks to make this program display a JFrame:

  import java.awt.*;
 
  public class microGUI
  {
    public static void main ( String args[] )
    {
      JFrame frm = new ___________();
      frm.___________( 150, 100 );
      frm.___________( true );
    }
  }
 

Explanation

The correct answer is JFrame, setSize, setVisible. In order to display a JFrame, we need to create a new JFrame object using the JFrame class. The setSize method is used to set the size of the JFrame, and the setVisible method is used to make the JFrame visible on the screen. Therefore, the correct code to display a JFrame would be "JFrame frm = new JFrame(); frm.setSize(150, 100); frm.setVisible(true);"

Submit
4. container object in GUI programming is

Explanation

The correct answer is "An object like a frame that has other GUI components placed inside of it." In GUI programming, a container object refers to an object that can hold and organize other GUI components such as buttons, labels, or text fields. It acts as a parent or holder for these components, allowing them to be arranged and displayed within the container's boundaries. Common examples of container objects in GUI programming include frames, panels, and windows. These containers provide a structure and layout for the GUI components, enabling the creation of complex and interactive user interfaces.

Submit
5. When you create a JFrame object, it is not automatically displayed.

Explanation

When a JFrame object is created, it is not automatically displayed because the display of the JFrame is controlled by the programmer. The programmer can choose when and how to display the JFrame by using methods such as setVisible(true) to make it visible on the screen. Therefore, the statement "When you create a JFrame object, it is not automatically displayed" is true.

Submit
6. How do you import all the classes in the AWT and Swing packages?

Explanation

This answer is correct because it imports all the classes in the AWT and Swing packages by using the wildcard (*) after the package names. This means that all the classes within these packages will be accessible in the current code file.

Submit
7. What sets the frame to 300 pixels wide by 200 high?

Explanation

The correct answer is frm.setSize(300, 200). This method sets the size of the frame to be 300 pixels wide and 200 pixels high.

Submit
8. In Java, what do you name an area on the screen that has fine borders and various buttons on the top border?

Explanation

In Java, an area on the screen that has fine borders and various buttons on the top border is called a frame. A frame is a container that holds other components such as buttons, text fields, or labels. It provides a window-like structure with a title bar, minimize, maximize, and close buttons. Frames are commonly used to create graphical user interfaces (GUIs) in Java applications.

Submit
9. JFrame myFrame = new JFrame ();
Any command (such as the listed one) which creates a new object of a specific class is usually called a...

Explanation

The given command "JFrame myFrame = new JFrame();" is creating a new object of the JFrame class. This is done by calling the constructor of the JFrame class, which is a special method used to initialize objects. Therefore, the correct answer is "constructor".

Submit
10. Upon clicking the X (close) button on a window, it looks like you have "killed" the program when in reality, it keeps on running, but you see no frame. This happened because you forgot to use the setDefaultCloseOperation( ) method, so by default, it used...  

Explanation

When the X (close) button on a window is clicked without using the setDefaultCloseOperation( ) method, the default close operation is used. In this case, the default close operation is JFrame.HIDE_ON_CLOSE. This means that when the X button is clicked, the window is hidden, but the program continues to run in the background. So, although it may appear that the program has been "killed" because the window is no longer visible, it is actually still running.

Submit
View My Results

Quiz Review Timeline (Updated): Jul 16, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Jul 16, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 30, 2011
    Quiz Created by
    Kawiz711
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Swing class which is used for frames, is
In what is the size of a frame on the screen measured?
Fill in the blanks to make this program display a JFrame:...
A container object in GUI programming is
When you create a JFrame object, it is not automatically displayed.
How do you import all the classes in the AWT and Swing packages?
What sets the frame to 300 pixels wide by 200 high?
In Java, what do you name an area on the screen that has fine borders...
JFrame myFrame = new JFrame ();...
Upon clicking the X (close) button on a window, it looks like you have...
Alert!

Advertisement