Java: Swing Frames Quiz! Trivia

10 Questions | Total Attempts: 979

SettingsSettingsSettings
Please wait...
Java: Swing Frames Quiz! Trivia

.


Questions and Answers
  • 1. 
    In Java, what do you call an area on the screen that has nice borders and various buttons along the top border?
    • A. 

      A window.

    • B. 

      A screen.

    • C. 

      A box.

    • D. 

      A frame.

  • 2. 
    What is the name of the Swing class that is used for frames?
    • A. 

      Window

    • B. 

      Frame

    • C. 

      JFrame

    • D. 

      SwingFrame

  • 3. 
    Which of the following sets the frame to 300 pixels wide by 200 high?
    • A. 

      Frm.setVisible( 300, 200 );

    • B. 

      Frm.paint( 300, 200 );

    • C. 

      Frm.setSize( 200, 300 );

    • D. 

      Frm.setSize( 300, 200 );

  • 4. 
    The size of a frame on the screen is measured in:
    • A. 

      Inches

    • B. 

      Nits

    • C. 

      Dots

    • D. 

      Pixels

  • 5. 
    What is a container object in GUI programming?
    • A. 

      A container is another name for an array or vector.

    • B. 

      A container is any class that is made up of other classes.

    • C. 

      A container is a primitive variable that contains the actual data.

    • D. 

      A container is an object like a frame that has other GUI components placed inside of it.

  • 6. 
    Fill in the blanks so that this program displays a JFrame:   import java.awt.*;     public class microGUI   {     public static void main ( String args[] )     {       JFrame frm = new ___________();       frm.___________( 150, 100 );       frm.___________( true );     }   }  
    • A. 

      Form, setVisible, setOn

    • B. 

      JFrame, setSize, setVisible

    • C. 

      Frame, setVisible, setSize

    • D. 

      Window, setSize, paint

  • 7. 
    JFrame myFrame = new JFrame (); Any command (such as the one listed above) which creates a new object of a specific class (in this case a new JFrame object called myFrame) is generally called a ...    
    • A. 

      Constructor

    • B. 

      Layout manager

    • C. 

      Parameter

    • D. 

      GUI

  • 8. 
    When you create a JFrame object it is not automatically displayed.
    • A. 

      True

    • B. 

      False

  • 9. 
    How do you import all the classes in the AWT and Swing packages?
    • A. 

      Import awt.* import swing.*

    • B. 

      Import java.awt import javax.swing

    • C. 

      Import java.awtx.* import java.swingx.*

    • D. 

      Import java.awt.* import javax.swing.*

  • 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 ...
    • A. 

      JFrame.EXIT_ON_CLOSE

    • B. 

      JFrame.HIDE_ON_CLOSE

    • C. 

      JFrame.DISPOSE_ON_CLOSE

    • D. 

      JFrame.DO_NOTHING_ON_CLOSE