Exam 12: A First Look at GUI Applications

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

The variable panel references a JPanel object. The variable bGroup references a ButtonGroup object, which contains several button components. If you want to add the buttons to the panel:

Free
(Multiple Choice)
4.8/5
(30)
Correct Answer:
Verified

D

This layout manager arranges components in regions named North, South, East, West, and Center.

Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
Verified

B

To end an application, pass this as the argument to the JFrame class's setDefaultCloseOperation() method.

Free
(Multiple Choice)
4.8/5
(45)
Correct Answer:
Verified

C

The minimize button, maximize button, and close button on a window are sometimes referred to as:

(Multiple Choice)
5.0/5
(36)

To use the Color class, which is used to set the foreground and background of various objects, use the following import statement:

(Multiple Choice)
4.8/5
(41)

What will be the result of executing the following statement? Panel.setBorder(BorderFactory.createLineBorder(Color.BLUE, 5));

(Multiple Choice)
4.8/5
(40)

You would use this command at the operating system command line to execute the code in the MyApplication class and display the graphic image Logo·jpg as a splash screen.

(Multiple Choice)
4.8/5
(39)

In a Swing application, you create a frame object from the:

(Multiple Choice)
4.8/5
(43)

A GUI program automatically stops executing when the end of the main method is reached.

(True/False)
4.9/5
(34)

In Swing, labels are created with this class:

(Multiple Choice)
4.8/5
(34)

A common technique for writing an event listener class is to write it as a private inner class inside the class that creates the GUI.

(True/False)
4.8/5
(36)

These components have a consistent look and predictable behavior on any operating system.

(Multiple Choice)
4.9/5
(38)

You use the ________ key word in a class header to indicate that it implements an interface.

(Multiple Choice)
4.8/5
(46)

Why doesn't the following code compile correctly? Import java.awt.*; Import java.awt.event.*; Import javax.swing.*; Public class ColorCheckBoxWindow extends JFrame { Private JCheckBox greenCheckBox; Private final int WINDOW_WIDTH = 300, WINDOW_HEIGHT = 100; Public ColorCheckBoxWindow() { SetTitle("Green Check Box"); SetSize(WINDOW_WIDTH, WINDOW_HEIGHT); SetDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); GreenCheckBox = new JCheckBox("Green"); GreenCheckBox.addItemListener(new CheckBoxListener()); SetLayout(new FlowLayout()); Add(greenCheckBox); SetVisible(true); } Public void itemStateChanged(ItemEvent e) { If (e.getSource() == greenCheckBox) { System.exit(0); } } }

(Multiple Choice)
4.9/5
(40)

Programs that operate in a GUI environment must be:

(Multiple Choice)
4.7/5
(37)

Check boxes may be grouped in a ButtonGroup, like radio buttons are.

(True/False)
4.8/5
(44)

What will be the result of executing the following statement? Panel.setBorder(BorderFactory.createTitleBorder("Title"));

(Multiple Choice)
4.9/5
(42)

How many radio buttons can be selected at the same time as the result of the following code? Hours = new JRadioButton("Hours"); Minutes = new JRadioButton("Minutes"); Seconds = new JRadioButton("Seconds"); Days = new JRadioButton("Days"); Months = new JRadioButton("Months"); Years = new JRadioButton("Years"); TimeOfDayButtonGroup = new ButtonGroup(); DateButtonGroup = new ButtonGroup(); TimeOfDayButtonGroup.add(hours); TimeOfDayButtonGroup.add(minutes); TimeOfDayButtonGroup.add(seconds); DateButtonGroup.add(days); DateButtonGroup.add(months); DateButtonGroup.add(years);

(Multiple Choice)
4.8/5
(40)

When an application uses many components, rather than deriving just one class from the JFrame class, it is often better to encapsulate smaller groups of related components and their event listeners into their own class. A commonly used technique to do this is:

(Multiple Choice)
4.8/5
(37)

The ability to display splash screens was introduced in Java 6.

(True/False)
4.9/5
(28)
Showing 1 - 20 of 60
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)