Controls and layout managers
Objectives
Applied
- Create a panel that includes a text area with a scroll bar.
- Create a panel that includes check boxes and radio buttons with the controls, and write an event listener that responds to click events for the controls.
- Create a border that includes both a line style such as etched or beveled and a title. Then, apply this border to a group of check boxes, radio buttons, or other controls.
- Create a panel that includes a combo box or list populated with data from an array or collection and write an event listener that responds when the user selects an item.
- Create an event handler that can process all of the items selected in a list that allows multiple selections.
- Create a panel that includes a list whose contents can be changed by the program.
- Given a desired layout for a panel, draw a grid that represents the layout, then use the GridBag layout manager to build the panel with the correct layout.
- Given the requirements for a program that uses text areas, scroll panes, check boxes, radio buttons, borders, combo boxes, and lists, write the code to implement the application.
Knowledge
- List two Swing components that are designed to enhance the appearance or operation of other controls.
- Describe a situation in which you would use a text area rather than a text field.
- List two ways a program can determine whether a user has selected a check box or radio button.
- Explain the difference between ActionEvent and ItemEvent for a combo box.
- Explain the difference between a combo box and a list.
- List six layout managers commonly used to build Swing applications, and describe the approach each takes to arranging controls in a panel.