magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 1996 > 10 > Features  

Your Own Java Layout Manager

Extending the Abstract Window Toolkit

By Cory Bear

While a small Java applet creates excitement with eye-catching animation or scrolling text, Java can be used for purposes more sophisticated than decorating your Web page. For example, larger applets with display components such as buttons, text fields, tables, and so on can be used as powerful, interactive user interfaces. The challenge in designing a large Java applet with many display components is finding a way to lay out those components attractively. How do you make text fields line up, or put a button in the correct spot? Java developers find the tools in the Abstract Window Toolkit (AWT) a big help, but many quickly learn that they need to design their own Java layout manager for advanced layout requirements. • This article explains how I designed a layout manager called StackLayout and provides useful tips on designing your own layout manager. StackLayout stacks display components one on top of another, so they all have the same width but different heights. For example, it is used in the applet shown in Figure 1 to lay out the "update" button, the "chart XYZ corp" text field, and a table of stock-quote information.

Java Layout Managers

Java provides five layout managers in the Abstract Window Toolkit (AWT), a package in the standard Java library: BorderLayout; CardLayout; FlowLayout; GridLayout; and GridBagLayout.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2