CSCI 4800/6800
Lecture Notes
Constructing a GUI Program
Jan. 16, 2007
Steps in constructing a GUI program:
- Choose applet or application (or both). For applications, create a
container object. For applets, the applet is a container object.
- Select a layout manager : FlowLayout, BorderLayout, etc.
- Create GUI components (buttons, labels, Choice, etc.)
- Add the GUI components to their "container"
- Specify behavior of the components by implementing the methods
of the appropriate listener interfaces.
- Add Listeners - that is, register the object(s) containing the
methods to be invoked when related events occur.
Components:
- Labels
- TextFields
- Buttons
- CheckBox / CheckBoxGroup
- Radio Buttons
- ComboBox
- List
- & more ...
Containers:
- Window
- Panel
- Applet (an extension of panel)
- Frame (an extension of window)
- & more
Interfaces/Adapters:
- ActionListener
- WindowListener
- MouseListener
- MouseMotionListener
- ComponentListener
- FocusListener
- ListSelectionListener
Layout Managers:
- FlowLayout
- BorderLayout
- CardLayout
- BoxLayout
- SpringLayout
- GridLayout
- GridBagLayout
We looked at examples from chapters 13 and 14 of the Deitel "Java: How to Program" book, 5th edition.
You can download the examples from the Deitel web site .
- Once at the Deitel site, click on "downloads"
- Scroll down to Java: How To Program , ver. 5
- You'll see that from there you can download:
- examples
- lecture slides
- Sun's SDK
Also, you'll likely want to download your own copy of Java, see:
The Java 2 Platform, Standard Edition
Finally, a good starting point for browsing and searching the online
documentation is:
the API specification