Book contents
- Frontmatter
- Contents
- INTRODUCTION
- GETTING STARTED WITH JAVA
- MIGRATING TO JAVA
- TECHNIQUES 101
- MODELING AND PATTERNS
- JAVA IN A DISTRIBUTED WORLD
- THREADS
- USER INTERFACES
- CONSTRUCTING MODULAR USER INTERFACES IN JAVA
- JFC's SWING, PART 1: MODEL/VIEW/CONTROLLER
- PANEL STATES: A USER INTERFACE DESIGN PATTERN
- SECURITY
- TESTING
- PERFORMANCE
- REALITY CHECK
- INDEX
CONSTRUCTING MODULAR USER INTERFACES IN JAVA
Published online by Cambridge University Press: 06 July 2010
- Frontmatter
- Contents
- INTRODUCTION
- GETTING STARTED WITH JAVA
- MIGRATING TO JAVA
- TECHNIQUES 101
- MODELING AND PATTERNS
- JAVA IN A DISTRIBUTED WORLD
- THREADS
- USER INTERFACES
- CONSTRUCTING MODULAR USER INTERFACES IN JAVA
- JFC's SWING, PART 1: MODEL/VIEW/CONTROLLER
- PANEL STATES: A USER INTERFACE DESIGN PATTERN
- SECURITY
- TESTING
- PERFORMANCE
- REALITY CHECK
- INDEX
Summary
Anyone who has ever tried to construct modular, object-oriented user interfaces using the AWT knows how hard it can be. The result can easily end up being difficult to debug, complex to understand and maintain, and certainly not reusable (except by cutting and pasting!). However, huge benefits can be obtained by separating out the user interface from the application code. This has been acknowledged for a long time and the Java Development Kit included the Observer class and the Observable interface to support this. However, with the addition of the delegation event model in the JDK 1.1, the potential for separating the view and control parts of the interface was provided. This allows the separation of the interface from the control elements (i.e., what to do when a user presses a button) and from the application code. Such a separation is often referred to as a model-view-controller architecture (or just as the MVC for short). The MVC originated in Smalltalk, but the concept has been used in many places. This article considers what the MVC is, why it is a good approach to GUI construction, and what features in Java support it. It then describes a GUI application which has been built using the MVC architecture. The source code for this application is provided as an appendix.
- Type
- Chapter
- Information
- More Java Gems , pp. 255 - 264Publisher: Cambridge University PressPrint publication year: 2000