01-11-2012, 03:35 PM
Java Graphical User Interfaces
Java Graphical.ppt (Size: 98.5 KB / Downloads: 34)
Graphical User Interfaces
Graphical User Interfaces
GUI
Say Gooey
The WIMP interface
Windows, Icons, Menus, & Pointers
Windows present our ‘main’ display of information
Icons are symbolic of some action or item
Menus provide a context-focused set of options
Pointers (the mouse) select from a graphical image
GUI & You
Xerox PARC
Design our own?
Consider a button
Four Polygons & a text component
A different ‘pressed’ button
Libraries of graphics components
Widgets, Controls
Event-Driven Programming
versus Procedural Programming
Creating Java AWT GUI
A Four Step Process:
1. Create the component:
Button ballB = new Button(“New Ball”);
2. Add the Component to the Container:
this.add(ballB);
3. Arrange the component in the container
Automatically by a layout manager
Specified layout management
4. Handle events for each component
Our private button listener
Java Containers
A container class object is a holder for graphical components
It may also hold other containers
Each container may have a specific way of arranging the components within it
This is the function of the Container’s Layout Manager
Layout Manager? More on this in a couple of slides
A word about Applets & Applications
Applets are inherently graphical
This is due to their derivation from Components
via Containers & Panels
Applications are not inherently graphical
In order to obtain a graphical context, Applications will instantiate a Frame object
Because Frames are also derived from components we can add other graphical components to those as well
Border & Card Layout managers
Border Layout
Five regions
May be at NORTH, EAST, SOUTH, WEST, or CENTER
Card Layout
Any number of components, only one of which is visible at a time
Think Rolodex or Recipe cards
Supplanted by Swing Tabbed Layout