CS401 Lab 9: Graphical User Interfaces


Introduction

We've started discussing Graphical User Interfaces and Event-Driven Programming. In this programming paradigm, GUI components are created and arranged in a hierarchy of GUI containers using various Layout Managers. Each GUI component is capable of generating EventObjects that are propagated to any number of event listeners registered to respond to those events. In this lab, you'll write a simple GUI application.


Lab9

Develop an application, Lab9.java, that has the GUI pictured below. Similar to other example programs we've seen, the program computes the area of a triangle but with a graphical interface. Two JTextFields are used to allow the user to enter the base and height of the triangle with two JLabels to the left that indicate what is expected to be entered. When the user clicks the "Calculate" button, the program should compute the area of the entered values and display the result below the button.

Some useful methods might be: