Featured Whitepapers
Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

MPAD: A new design and development methodology for multi-panel applets

Find out how to use this generic, flexible design for deploying robust, multi-screen Java applets over the Internet, intranets, and extranets

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Java can be used to develop applets, standalone applications (GUI and console), and packages (library of reusable classes). Unlike applications, however, applets are typically confined to Web browsers and therefore are somewhat limited in their user interface design. To get around this limitation, I will provide you with a generic, flexible and well-thought-out design for Java applets, giving you a head start into deploying robust, multi-screen applets over the Internet, intranets, and extranets.

An applet primer

Generally speaking, applets are embedded in HTML pages using the <APPLET> tag. When a user requests an HTML page, the browser parses the HTML text and upon detecting the <APPLET> tag, requests that the Web server send the class file pointed to by the CODE attribute; any other class files referenced by the initial class file also are downloaded as needed. Once the required class files download successfully, the browser runs the applet within the HTML page, using the WIDTH and HEIGHT specified in the <APPLET> tag as the applet's display area.

Interface obstacles
The standard applet user interface works fine for mini applets that can function within one given applet screen. However, this one-screen-per-HTML-page method does not scale well for organizations that need to deliver robust programs to their target audience over the Internet, intranet, or extranets.

There are some alternatives to this standard interface. You can launch windows in their own frames, which provides a way for applets to contain more than one window at one time. Another alternative is to use dialog boxes for additional screens. Although these alternatives do provide solutions to the standard interface, many users find them annoying. I continually hear gripes about Web sites that clutter desktops with additional browser windows.

So, what do you do if your applet requires multiple screens, but having separate windows is not a viable option? The answer: Use a design that works in the confinement of a single HTML page, but allows multiple screens in a single applet embedded in that HTML page.

Desperately seeking solutions: the Multi-Panel approach

The Multi-Panel Applet Design (MPAD), which allows multiple panels, or screens, to be incorporated into a single applet, is perfect for applets but can just as easily be applied to standalone GUI applications. MPAD is not a new Java API or technology; rather, it is a design that provides some significant benefits:

  • Developers can create individual panels independently and integrate them into the applet at a later point
  • Individual panels can be efficiently unit-tested by their developers
  • Data can be exchanged between panels in an easy, extensible, and extremely flexible fashion
  • The applet's functionality can be enhanced using JavaScript


MPAD uses a Panel Manager to control individual panels. Each panel consists of GUI controls/widgets and performs a specific task. For example, a login panel might contain TextField objects to obtain an ID and password from a user and perform login authentication for a given system. The panels are chained together in a sequence, with the last panel in sequence visible in the applet's display area. This mechanism is similar to a stack where you can "push" (and "pop") objects onto the stack, but can only "peek" at the object on top of the stack. Note:Although MPAD allows you to see only one screen at a time, you can easily overcome this limitation by extending the design.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comment
Login
Forgot your account info?
Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources