Activity 6.3 - Simulating a control panel in a lift

Topic

In this activity we build up a more complex window design by nesting several JPanels in the content pane.

Task

You are asked to write a program that will simulate the control panel in a lift. Here is a sketch the designer has drawn.

The figure displays a rectangle, with various buttons and labels to make it look like the control panel in a lift.
The figure is described in detail in the main text immediately below the figure.

On the content pane there are three panels.

Notes

The text fields should be four and two characters wide respectively. For the purposes of this prototype they can just be left blank. To create a JTextField of the desired width use the constructor

JTextField(int columns) 

A JTextField is added to a panel in exactly the same way as we add a JButton.

Instructions

  1. Create a new project called MyEx6_3 in the Unit 6 folder. In the New Java Application wizard name the Main Class myex6_3.LiftButtonFrameTest.
  2. Add a new Java class LiftButtonFrame to the project. Complete the coding for this class so that when an instance of LiftButtonFrame is displayed it will appear as in the design sketch above.
  3. Complete the main class LiftButtonFrameTest so it creates a test instance of LiftButtonFrame and makes it visible. Compile and run your project.
  4. Our specimen solution can be found in the Solution file.