Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 1 (5 points) The method __________ sets the background color to yellow

ID: 3764878 • Letter: Q

Question

Question 1 (5 points)

The method __________ sets the background color to yellow in JFrame frame.

setBackground(Color.YELLOW)

frame.setBackGround(Color.yellow)

frame.setBackground(Color.YELLOW)

setBackground(Color.yellow)

Save Question 2 (5 points) Question 2 Saved What layout manager should you use so that every component occupies the same size in the container?

Question 2 options: GridLayout FlowLayout BorderLayout any layout Save

Question 3 (5 points) Question 3 Saved Which of the following statements is for terminating the program when closing the frame?

Question 3 options: frame.setDefaultCloseOperation(JFrame.STOP_ON_CLOSE) frame.setDefaultCloseOperation(JFrame.TERMINATE_ON_CLOSE) frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setDefaultCloseOperation(null) Save

Question 4 (5 points) Question 4 Unsaved Which of the following statements about containers is correct?

Question 4 options: A panel can be placed inside a panel A frame can be placed inside a panel Both frames and panels can be placed inside a panel A frame can be placed inside a frame Save

Question 5 (5 points) Question 5 Unsaved Which method call puts the string "Result" into the TextField named result?

Question 5 options: result.findText() result.newText("Result") result.setText("Result") result.text("Result") Save Question 6 (5 points)

Question 6 Saved How many items can be added into a JComboBox object?

Question 6 options: 2 Unlimited 1 0 Save

Question 7 (5 points) Question 7 Unsaved What kind of object is used group radio buttons?

Question 7 options: ButtonGroup JButtonGroup ContainerGroup Group Save

Question 8 (5 points) Question 8 Saved Which of the following method calls is used to prevent the user from modifying a text field tf?

Question 8 options: tf.setUneditable() tf.setEditable(false); tf.preventMdification() tf.setChangable(false); Save Question 9 (5 points)

Question 9 Unsaved When you want to allow the user to select only one of several choices, which you use?

Question 9 options: Check boxes Text fields Ordinary buttons Radio buttons Save Question 10 (5 points)

Question 10 Saved What is the benefit of using layout managers?

Question 10 options:

It reduces the amount of memory necessary to store the window components

It makes the program run much faster

It defines how components of a window should be arranged when it is resized It reduces the amount of code needed Save

Question 11 (5 points) Question 11 Unsaved Which of the following true about source and listener objects?

Question 11 options:

They must always be different objects

Both objects must be of the same type

They can be the same object

The objects must always be of different types

Explanation / Answer

1.

To set the background color to the frame in JFrame, call the setBackground method with JFrame class object and parameters are the type of the color.

(B) f.setBackground(Color.YELLOW)

(C) f.setBackground(Color.yellow)

Thus the correct option is (B) and (C)

2.

Thus the Correct option (A) is GridLayout

3.

When close the program automatically it terminates the JFrame window, for this use the method setDefaultCloseOperation with JFrame class object.

A. frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)

Thus the correct option is (A)

6.

Add the number of items to the JComboBox object. That means there is no limit for add the items to the JComboBox object.

Thus the Correct option is (B) Unlimited

8.

setUneditable method is used to prevent modifying text field.

Thus the correct option (A) is tf.setUneditable()

9.

User want to select one choice in multiple choices then select Radio button is the better option.

Thus the correct option (D) Radio button

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote