Questions from Starting Out With Java


Q: How do you place a menu bar in a JFrame?

How do you place a menu bar in a JFrame?

See Answer

Q: What is the index of the first item stored in a JList

What is the index of the first item stored in a JList or a JComboBox component? If one of these components holds 12 items, what is the index of the 12th item?

See Answer

Q: What type of event do menu items generate when selected by the

What type of event do menu items generate when selected by the user?

See Answer

Q: Write the declaration for class B. The class’s members

Write the declaration for class B. The class’s members should be as follows: - m, an integer. This variable should not be accessible to code outside the class or to any class that extends class B. -...

See Answer

Q: How do you change the size of a component such as a

How do you change the size of a component such as a JLabel after it has been ­created?

See Answer

Q: What arguments do you pass to the Dimension class constructor?

What arguments do you pass to the Dimension class constructor?

See Answer

Q: What arguments do you pass to the JTextArea constructor?

What arguments do you pass to the JTextArea constructor?

See Answer

Q: How do you retrieve the text that is stored in a JTextArea

How do you retrieve the text that is stored in a JTextArea component?

See Answer

Q: Does the JTextArea component automatically display scroll bars? If not,

Does the JTextArea component automatically display scroll bars? If not, how do you accomplish this?

See Answer

Q: What is line wrapping? What are the two styles of line

What is line wrapping? What are the two styles of line wrapping? How do you turn a JTextArea component’s line wrapping on? How do you select a line wrapping style?

See Answer