Exam 10: Graphical User Interfaces

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

Consider the following code snippet: JPanel panel = new JPanel(); JFrame frame = new JFrame(); JButton button = new JButton("Click me"); JLabel label = new JLabel("Show the answer"); Frame.add(label); Frame.add(button); Panel.add(frame); Which of the following statements is true?

(Multiple Choice)
4.8/5
(34)

Complete this code fragment to ensure that the application exits properly when the user closes the frame: JFrame frame = new JFrame();

(Multiple Choice)
4.7/5
(34)

Which of the following statements about events and graphical user interface programs is true?

(Multiple Choice)
4.9/5
(41)

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

(Multiple Choice)
5.0/5
(40)

Consider the following code snippet: JPanel panel = new JPanel(); JFrame frame = new JFrame(); JLabel label = new JLabel("Show the answer"); JTextField field = new JTextField(5); Frame.add(label); Frame.add(field); Panel.add(frame); Which of the following statements is true?

(Multiple Choice)
4.8/5
(34)

Place drawing instructions inside the __________ method, which is called whenever the component needs to be repainted.

(Multiple Choice)
4.8/5
(34)

Which of the following is an event source?

(Multiple Choice)
4.8/5
(30)

Which of the following statements should be added to this code fragment to set the frame size to a width of 400 and a height of 200? Final int FRAME_WIDTH = 400; Final int FRAME_HEIGHT = 200; JFrame frame = new JFrame();

(Multiple Choice)
4.8/5
(42)

Event listeners are often installed as ____ classes so that they can have access to the surrounding fields, methods, and final variables.

(Multiple Choice)
4.9/5
(33)

Which container is used to group multiple user-interface components together?

(Multiple Choice)
4.8/5
(37)

What's the difference between a text field and a text area?

(Multiple Choice)
4.7/5
(39)

Which java package must be imported if a program wishes to respond to button events?

(Multiple Choice)
4.9/5
(36)

The Graphics class is part of the ____________________ package.

(Multiple Choice)
4.8/5
(33)

Consider the following code snippet: JFrame frame = new JFrame(); JPanel panel = new JPanel(); Which statement would add the panel to the frame?

(Multiple Choice)
4.8/5
(40)
Showing 41 - 54 of 54
close modal

Filters

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