Objectives

Be able to:

  • Create a GUI that uses Absolute Layout

Instructions

1. Design and create a GUI similar to the Sample Output using java coding. Your design need not match mine, but your GUI must have the same components as mine and be well-designed.

2. You must use Absolute Layout techniques.

3. You are to hand-code this program. If you are using an IDE that can produce GUIs you should not use that capability. You should not use JavaFX.

4. This week's lab will have no functionality. You will not need to program any Listeners

  • If a radio button is selected nothing should happen. The buttons should be mutually-exclusive.
  • If the "click to Process" key is pressed nothing should happen.
  • If values are entered into the textFields nothing should happen.
  • In next week's lab Listeners will add functionality based on the radio button that the user selects and the Process button.

5. The Sample Output uses 6 labels, 4 radioButtons, 4 textFields, 5 Panels and 1 button

  • Labels
    • titleLabel
    • radiolabel
    • widthLabel
    • heightLabel
    • radiusLabel
    • lengthLabel
  • Radio Buttons (note: buttons must be mutually exclusive... they must be part of a group)
    • rectangleRadioButton
    • boxRadioButton
    • circleRadioButton
    • cylinderRadioButton
  • Text Fields
    • widthTextField
    • lengthTextField
    • heightTextField
    • radiusTextField
  • Panels...put related components on a panel, then add the panels to the main GUI.
    • radioButtonPanel
    • widthPanel
    • lengthPanel
    • heightPanel
    • radiusPanel
  • Button
    • processButton

6. Create and add the titleLabel to your totalGUI...totalGUI.add(titleLabel).

7. Create and add your radio buttons to your radioButton Panel

  • note: buttons must be mutually exclusive...they must be part of a group.

8. Add each related label and field to their respective panel...widthLabel and width TextField are added to widthPanel, etc.

  • Set the location of each component in the Panel
  • Set the Panel's location on the totalGUI
  • Add each panel to your to your bottom panel...totalGUI.add(widthPanel)

9. Create and add your processButton to your totalGUI

10. Make sure that you have consulted the example GUIs, the lecture notes, and other materials.

11. Here is a way to change the font on your GUI

  • Font titleFont = new Font("Verdana", Font.BOLD, 26); myTitleLabel.setFont(titleFont);

Sample Output

Figure: see image.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.