Chapter Questions
Layout managers adapt automatically to changes in the size of a container or one of its components. (T / F)
Which package contains layout managers?
How does the FlowLayout manager arrange components?
Write a single statement that gives the current container a flow layout with right alignment.
What are the five regions established by the BorderLayout manager?
The sizes of the five regions in a border layout are determined at runtime based on the contents of the four outer regions. (T / F)
By default, how many components can you put in any one region of a border layout?
Write a single statement that adds a new JLabel with the text "Stop" to the center region of a BorderLayout manager. The label should be centered within the center region.
When you instantiate a GridLayout manager, you should always specify both the number of rows and the number of columns. (T / F)
In a grid layout, all cells are the same size. (T / F)
What happens to the $x$ Turn variable in the Tic-Tac-Toe program if you click the same cell twice?
Why are JPanel containers particularly useful with GridLayout and BorderLayout windows (as opposed to FlowLayout windows)?
In the MathCalculator program's createcontents method, what's the purpose of the add (new JLabel () ) ; statement?
JTextArea components are editable by default. (T / F).
JTextArea components employ line wrap by default. (T / F).
What happens if you click a check box that's already selected?
Provide a statement that creates a check box named attendance. The check box should be pre-selected, and it should have an "I will attend" label.
What happens if you click a radio button that is already selected?
What happens if you click an initially unselected radio button that is a member of a RadioGroup?
How are combo boxes and radio button groups similar?
What two methods can be called to determine the current selection for a combo box?
The JobApplication program contains the following code fragment. What happens to the program if the code fragment is omitted?radioGroup = new ButtonGroup();radioGroup.add(goodCitizen);radioGroup.add(criminal);
Provide a statement that adds a 20 -pixel blank margin to a JPanel container named panel.
Provide a JSIider constructor call where the minimum value is $0,$ the maximum value is $50,$ and the initial value is $10 .$ Hint: Look up the answer on Sun's Java API Web site.