CIS 160 Non-functional GUI

Objectives

  • Create graphical components
  • Use layout managers

Program requirements

Create the GUI shown in the example. You do not have to provide any functionality. The three layout managers you should use are BorderLayout, FlowLayout, and GridLayout. Layouts can be nested using JPanels as containers for the nested layouts.

Example

This is the GUI you have to create:

Non-working GUI picture

The following image has borders added to the JPanels that were used to group elements of the GUI. This should help you decide how to use JPanels, how to nest them, and how to set their layout managers.

Notes

The following examples may help with the assignment. The variable names can be any valid variable name.

Create a JPanel: JPanel pnl = new JPanel(); Create a label: JLabel lbl = new JLabel("Caption"); Create a button: JButton btn = new JButton("Caption"); Create a checkbox: JCheckBox cbox = new JCheckBox("Caption"); Create a "checked" checkbox: JCheckBox cbox = new JCheckBox("Caption", true); Create a radio button: JRadioButton rbtn = new JRadioButton("Caption"); Create a "selected" radio button: JRadioButton rbtn = new JRadioButton("Caption", true); Create an array of Strings for a combobox: String[] names = {"Al", "Bob", "Peg" }; Create a combobox: JComboBox combo = new JComboBox(names); Create a radio button group: ButtonGroup grp = new ButtonGroup(); Add a radiobutton to a buttongroup: grp.add(rbtn);

Rubric

  • 15 points for creating the components correctly
  • 20 points for getting the layout of the GUI correct
  • 5 points for proper documentation comments and for correctly following coding conventions (indentation, naming rules, etc.)