Exam 10: Graphical User Interfaces

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

If a text field holds an integer, what expression do you use to read its contents?

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

C

When a component is added to a container, what does the exact location and size of the component depend on?

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

A

To respond to a button event, a listener must supply instructions for the ____ method of the ActionListener interface.

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

B

Consider the following code snippet: Import ____________________ Import java.awt.event.ActionListener; /** An action listener that prints. */ Public class ClickListener implements ActionListener { Public void actionPerformed(ActionEvent event) { System.out.println("I was clicked."); } } Which of the following statements will complete this code?

(Multiple Choice)
4.7/5
(41)

Consider the following code snippet: Public class ClickListener implements ActionListener { Public void actionPerformed(ActionEvent event) { System.out.println("I was clicked."); } } Public class ButtonTester { Public static void main(String[] args) { JFrame frame = new JFrame(); JButton button = new JButton("Click me!"); Frame.add(button); ActionListener listener = new ClickListener(); Button.addActionListener(listener); ).. } } Which of the following statements is correct?

(Multiple Choice)
4.7/5
(44)

When drawing complex shapes, make a separate class for each part and provide a(n) ___ method that draws the shape.

(Multiple Choice)
4.8/5
(31)

Based on the following statement, which of the following statements sets the title of the frame: JFrame frame = new JFrame();

(Multiple Choice)
4.8/5
(31)

The methods of a/an ____ describe the actions to be taken when an event occurs.

(Multiple Choice)
4.8/5
(40)

Which of the following statements creates a button with "Calculate" as its label?

(Multiple Choice)
4.9/5
(41)

Which statements will create an editable text field and assign "Your choice" to it?

(Multiple Choice)
4.7/5
(40)

When an event occurs, the event source notifies all associated ____.

(Multiple Choice)
4.8/5
(45)

Which of the following statements about listener classes is true?

(Multiple Choice)
4.9/5
(34)

Insert the missing statement(s) in the following code fragment. The code is intended to display a message "Your cost is: " in a text area and display the cost on the next line. Double cost = 500.99; String message = "Your cost is:"; JTextArea result = new JTextArea(10, 30); __________________________________________ Result.setEditable(false);

(Multiple Choice)
4.9/5
(41)

Consider the following code snippet that is supposed to show the total order amount when the button is clicked: Public static void main(String[] args) { Final Order myOrder = new Order(); JButton button = new JButton("Calculate"); Final JLabel label = new JLabel("Total amount due"); ) . . Class MyListener implements ActionListener { Public void actionPerformed(ActionEvent event) { Label.setText("Total amount due " + myOrder.getAmountDue()); } } ActionListener listener = new MyListener(); } What is wrong with this code?

(Multiple Choice)
4.9/5
(38)

An inner class can access local variables from the enclosing method only if they are declared as ____.

(Multiple Choice)
4.9/5
(42)

How do you specify what the program should do when the user clicks a button?

(Multiple Choice)
4.8/5
(35)

Which statement will add a dollar sign and the value of the double variable balance to a JTextArea component called results?

(Multiple Choice)
4.7/5
(41)

A/an ____ object contains methods that describe the actions to be taken when a user clicks a user-interface graphical object.

(Multiple Choice)
4.9/5
(41)

An event listener for a button must implement the ____ interface.

(Multiple Choice)
5.0/5
(42)

The ____ method should be called whenever you modify the shapes that the paintComponent method draws.

(Multiple Choice)
4.8/5
(32)
Showing 1 - 20 of 54
close modal

Filters

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