14.8 Summary


14.8 Summary

For graphical applications, KJP and Java make extensive use of the Java packages AWT and Swing. These packages have a large number of predefined component and container classes for graphical user interfaces.

The purpose of a graphical user interface is to give the user a clear and attractive representation of relevant data, guide the user in the operation of the application, and facilitate his interaction with the program, and also provide some level of checking and verification of the input data.

A window is defined as a frame, which is the largest type of container. Graphical components and smaller containers are added to a frame in various manners, depending on the layout manager. Components and containers cannot be directly added to a frame; the content pane of the frame has to be used to add the graphical elements.

Typical graphical elements are labels, buttons, text fields, and drawing areas. Types of containers are frames and panels.

Various components are defined with listener objects that respond to the user in different ways. Buttons and text fields are components that generate events when the user clicks a button. These components can have object listeners attached. Listener objects handle the events that are generated by buttons and/or text fields. This is why the programs with graphical user interfaces (GUIs) are also called event-driven applications.

More detailed documentation of the various classes in the AWT and Swing packages for constructing graphical applications can be found on the Sun Microsystems Web pages. The following Web page has links to the various documentation pages for the Java packages as well as pages for tutorials.

  • http://java.sun.com/docs




Object-Oriented Programming(c) From Problem Solving to Java
Object-Oriented Programming (From Problem Solving to JAVA) (Charles River Media Programming)
ISBN: 1584502878
EAN: 2147483647
Year: 2005
Pages: 184

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net