Comments
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Cloud Expo on Google News


2008 West
DIAMOND SPONSOR:
Data Direct
SOA, WOA and Cloud Computing: The New Frontier for Data Services
PLATINUM SPONSORS:
Red Hat
The Opening of Virtualization
GOLD SPONSORS:
Appsense
User Environment Management – The Third Layer of the Desktop
Cordys
Cloud Computing for Business Agility
EMC
CMIS: A Multi-Vendor Proposal for a Service-Based Content Management Interoperability Standard
Freedom OSS
Practical SOA” Max Yankelevich
Intel
Architecting an Enterprise Service Router (ESR) – A Cost-Effective Way to Scale SOA Across the Enterprise
Sensedia
Return on Assests: Bringing Visibility to your SOA Strategy
Symantec
Managing Hybrid Endpoint Environments
VMWare
Game-Changing Technology for Enterprise Clouds and Applications
Click For 2008 West
Event Webcasts

2008 West
PLATINUM SPONSORS:
Appcelerator
Get ‘Rich’ Quick: Rapid Prototyping for RIA with ZERO Server Code
Keynote Systems
Designing for and Managing Performance in the New Frontier of Rich Internet Applications
GOLD SPONSORS:
ICEsoft
How Can AJAX Improve Homeland Security?
Isomorphic
Beyond Widgets: What a RIA Platform Should Offer
Oracle
REAs: Rich Enterprise Applications
Click For 2008 Event Webcasts
SYS-CON.TV
Top Links You Must Click On


AFC- User Interface Controls
AFC- User Interface Controls

Foundations
This month I wrap up my two part review of the Application Foundation Classes with a closer look at the user interface controls it provides. In my past two columns, I've showed you how to install and use the Java SDK 2.0, which includes the Application Foundation Classes, and how to begin using the Application Foundation Classes in your own applications. Now it's time to take a closer look at what the Application Foundation Classes can do for the user interfaces of your Java applications.

The Controls
The Application Foundation Classes provide a number of enhanced user interface controls which can be used in your applications. These controls include:

  • Static controls - Used to display static text, graphic or both
  • Buttons - Used to create push buttons, radio buttons and check boxes
  • Lists - Used to create lists, combo boxes and dropdown combo boxes that contain text or graphics
  • Menus - Used to create floating menus, which can also include other buttons
  • Edit controls - Used to create single and multi-line edit controls
  • Status controls - Used to create status and progress bar controls
  • Tree controls - Used to create tree-like controls similar to those found in the Windows Explorer application

    The Application Foundation Class user interface controls make it easy to mix and match different types of controls. It's very easy to mix text and graphics on many of the controls. Next, I review the more common user interface controls. I will show you how to create static controls, buttons and menus using the Application Foundation Classes. Note: For your reference, in the last Visual J++ Corner column I provided a complete hierarchy of the Application Foundation Classes, including all of the user interface classes.

    Static Controls
    There are three primary types of static controls in the Application Foundation Classes. They are the static text control, the static graphic control and the static item control (used to display both text and a graphic image). The static text control is represented by the UIText class, the static graphic control by the UIGraphic class and the static item control by the UIItem class. The UIText constructor takes a single parameter - the text to be displayed. The UIGraphic control also takes a single constructor parameter - an Image object which represents the image to be displayed. Finally, the UIItem control takes three important parameters - the text to display, an Image object representing the graphic to display and text alignment constants. Listing 1 presents a simple panel class that creates each of these static controls. Figure 1 illustrates how these controls are rendered.

    Buttons
    There are three primary types of button controls in the Application Foundation Classes. They are push button controls, radio button controls and check box controls. The push button control is represented by the UIPushButton class, the radio button control by the UIRadioButton class and the check box control by the UICheckButton class. The UIPushButton constructor takes two parameters - the text of the button and style of the button. You can create three button styles: using the UIPushButton.RAISED constant, you can create a standard push button; using the UIButton.TOGGLE constant, you can create a two-state button; using the UIButton.TRITOGGLE, you can create a three-state button. If you substitute a UIGraphic or UIItem object for the text parameter in the constructor, you can easily create a button that displays a graphic or text and a graphic. The UIRadioButton and UICheckButton constructors each take a single parameter - simply the text to display on the button. Listing 2 shows you how to create buttons using the Application Foundation Classes. Figure 2 illustrates how the buttons defined in Listing 2 are rendered.

    Menus
    Finally, the last Application Foundation Class I will review here is the Menu control. Menu controls are comprised of three main classes: UIMenuItem, which represents an actual menu item; UIMenuList, which represents a list of menu items; and UIMenuButton, which represents a menu push button. When a menu push button is pressed, the menu is displayed. Menus are pretty easy to put together. As outlined in Listing 3, you begin by creating a menu list. The UIMenuList.add method is called to add new menu items. You can add text strings to create simple text-based menu items or you can create complex menu items by adding different types. In the example in Listing 3, I have added a check box menu item by simply adding a UICheckButton object to the menu list and a graphic and text menu item by adding a UIItem object to the menu list. It's also easy to create sub-menus: just add another menu list to the main menu list. Once you have constructed your menu hierarchy, the UIMenuButton item is created, which marries a menu list with the menu button. Figure 3 illustrates the menu defined in Listing 3.

    J/Direct and the Future of AFC
    The Application Foundation Classes are certainly powerful. I've only touched the tip of the iceberg; the Application Foundation Classes also include a set of Enterprise Classes. The Application Foundation Enterprise Classes include the ability to build transaction-enabled applications in Java that interface with Microsoft Transaction Server and also provide access to legacy information systems and databases.

    Microsoft has announced their J/Direct initiative, which will be part of the Java Virtual Machine in Internet Explorer Version 4.0. J/Direct should strike fear into the hearts of the pure Java camp, as it will allow Java applications written for the new Microsoft Java Virtual Machine to directly access the Windows API. Does this mean that developers will rush to create applications using the J/Direct interfaces? I prefer to wait and see. Even though this industry moves at faster than light speeds, sometimes it takes the future a lot longer to get here than you'd expect. It is my opinion though that some sort of marriage between the Application Foundation Classes and J/Direct is somewhere in the near future, with a set of Application Foundation Classes optimized for the Windows VM that utilize J/Direct and another portable set that doesn't. This could create a win-win situation for developers, since they could still develop portable applications, but rely on the speed and close integration with the Windows platform when running on the Java Virtual Machine. Will I be right? I don't know, but it's an interesting enough story to keep me tuned in every day.

    Next Month: The Visual J++ Database Wizard: Is The Magic Right For You?

    About John Fronckowiak
    John Fronckowiak is the President of IDC Consulting, Inc., providing consulting and technical writing. He is also a Clinical Assistant Professor in Information Systems at the Adult Learning Program of Medaille College and is the author of several books and articles about iPhone development, programming, database design and development and networking. Fronckowiak has previously spoken at the Internet Commerce Expo in Boston, and the Conference on Instructional Technologies. In addition, he has over a decade of experience in the classroom as a college professor and runs dozens of training sessions for application developers.

  • In order to post a comment you need to be registered and logged in.

    Register | Sign-in

    Reader Feedback: Page 1 of 1

    Enterprise Open Source Magazine Latest Stories . . .
    Apache Deltacloud, the Red Hat-contributed ReSTful API that abstracts differences between clouds so services on any cloud can be managed – provided of course there’s a driver – has graduated from the Apache Foundation’s incubator and is now a full-fledged Top-Level Project (TLP). The...
    With Cloud Expo 2012 New York (10th Cloud Expo) just four months away, what better time to start introducing you in greater detail to the distinguished individuals in our incredible Speaker Faculty for the technical and strategy sessions at the conference... We have technical and st...
    AMD said late Tuesday that its chief sales officer Emilio Ghilardi had left the company and that CEO and president Rory Read is going to do his job while a replacement is sought. AMD didn’t say why Ghilardi left but it’s assumed Read wants his own people. Read is relatively new to th...
    During the lifespan of M3 (Monitis Monitor Manager) there has always been something lacking – timers. M3 execution procedure was outlined in this previous article. The execution mentioned in the latter was a one-time-execution, whereas server monitoring requires periodic invocati...
    Red Hat is putting its bought-in Gluster scale-out NAS storage technology, acquired in October, on the Amazon cloud. It’s styled Red Hat Virtual Storage Appliance for Amazon Web Services and other clouds are supposed to follow in short order.
    A new episode of the screencast series is now available at the OpenNebula YouTube Channel. This screencast demonstrates the new easily-customizable self-service portal for cloud consumers. Its aim is to offer a simplified access to shared infrastructure for non-IT end users. The scree...
    Subscribe to the World's Most Powerful Newsletters
    Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021


    SYS-CON Featured Whitepapers
    ADS BY GOOGLE