Exam 7: A First Look at Gui Applications

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

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.8/5
(39)

To include Swing and AWT components in your program,use the following import statements

(Multiple Choice)
4.8/5
(35)

Which of the following statements is not true?

(Multiple Choice)
4.8/5
(34)

Assume that radio references a JRadioButton object.To click the radio button in code,use the following statement.

(Multiple Choice)
4.8/5
(39)

When a component is added to a region in the BorderLayout manager,

(Multiple Choice)
4.9/5
(27)

In Java,the ability to display splash screens was introduced in Java 6.

(True/False)
4.8/5
(32)

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

(Multiple Choice)
4.8/5
(28)

The following statement adds the FlowLayout manager to the container,centers the components,and separates the components with a gap of 10 pixels. setLayout(new FlowLayout());

(True/False)
4.8/5
(40)

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
(37)

This is a graphic image that is displayed while an application loads into memory and starts up.

(Multiple Choice)
4.9/5
(33)

Which of the following statements creates a class that is extended from the JFrame class?

(Multiple Choice)
4.8/5
(34)

Which of the following statements is not true?

(Multiple Choice)
4.9/5
(44)

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
(43)

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

(Multiple Choice)
4.8/5
(31)

Which of the following is not a rule for the FlowLayout manager?

(Multiple Choice)
4.9/5
(39)

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

(True/False)
4.8/5
(32)

When an application uses many components,instead of extending just one class from the JFrame class,a better approach is to

(Multiple Choice)
5.0/5
(44)

The GridLayout manager limits each cell to only one component.To put two or more components in a cell,do this.

(Multiple Choice)
4.9/5
(43)

This layout manager arranges components in rows.

(Multiple Choice)
4.7/5
(33)

When you write an action listener class for a JButton component,it must

(Multiple Choice)
4.9/5
(46)
Showing 21 - 40 of 49
close modal

Filters

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