Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Build Web apps with ThinWire and Java code, Part 2: Using the SplitLayout Class

Combine SplitLayout management with your own dynamic layout management code

Professor Richard G Baldwin (baldwin@dickbaldwin.com), Professor of Computer Science, Austin Community College

Richard Baldwin is a college professor (at Austin Community College in Austin, Texas) and private consultant whose primary focus is a combination of Java, C#, and XML programmin. With 32 years of industry experience and 12 years of teaching experience, he has concentrated on teaching a full load of Java and OOP programming classes since 1997.

Richard has participated in numerous consulting projects and frequently provides onsite training at the high-tech companies located in and around Austin. He is the author of Baldwin's Programming Tutorials, which have gained a worldwide following among experienced and aspiring programmers.

In addition to his programming expertise, Richard has many years of practical experience in Digital Signal Processing (DSP). He began his career doing DSP in the Seismic Research Department of Texas Instruments. In the following years, he applied his programming and DSP expertise to other interesting areas, including sonar and underwater acoustics.

Richard holds an MSEE degree from Southern Methodist University and has many years of experience in the application of computer technology to real-world problems.

Summary:  With ThinWire, an open-source development framework, you can build Web applications that look and feel like desktop applications. In this five-part series, you'll learn how to develop rich Web applications using ThinWire and Java. In Part 2, you learn to use the SplitLayout class in conjunction with your own layout management code to dynamically change the layout of a ThinWire GUI based on the current size of the Web browser window.

View more content in this series

Date:  03 Jan 2007
Level:  Intermediate PDF:  A4 and Letter (439 KB | 43 pages)Get Adobe® Reader®

Activity:  9475 views
Comments:  

Before you start

As you learned in Part 1, the open-source development framework ThinWire (see Resources for more information) allows developers to use Java code exclusively for the development of Web applications.

All of the code for a ThinWire Web application is written in the Java language just as though it is a standalone, event-driven program designed to be run on the desktop. It is then compiled into a Web application by the ThinWire framework using the standard Sun javac compiler. A special compiler provided by another vendor isn't required.

About this series

This is one lesson in a series designed to teach you how to develop rich Web applications using ThinWire and Java code. The earlier lesson titled "Developing Ajax Web Applications using ThinWire and Java" (see Resources) was designed to help you begin to develop Web applications using the ThinWire framework. Part 1 ("Web App Layout Management;" see Resources) was designed to help you learn how to deal with user interface layout issues in ThinWire. In Part 2, you'll learn how to use the SplitLayout class in conjunction with your own layout management code to dynamically change the layout of a ThinWire GUI based on the current size of the Web browser window.


About this tutorial

Missing the layout managers of standard Java programming

In Part 1, I told you that ThinWire doesn't provide layout managers such as BorderLayout and FlowLayout. Rather, much of the sizing and positioning of GUI components in the client area of the browser must be done on an absolute pixel coordinate basis. Therefore, to protect against the kinds of problems that result from manually resizing the browser window, and the kinds of problems that result from the developer and the user having monitors with different resolutions, the developer will usually need to provide her own dynamic layout management. I provided a technique that you can use to easily accomplish dynamic layout management.

SplitLayout and VisibleLayout

What I didn't discuss is that ThinWire does provide two layout managers, neither of which bear any resemblance to the layout managers provided by standard Java programming. (When I refer to a standard Java environment, I will usually be referring to J2SE 5.0.) The two layout managers provided by ThinWire are implemented by the following classes:

  • SplitLayout
  • VisibleLayout

I'll demonstrate how to use the SplitLayout class in this part. But I'll defer my explanation of the VisibleLayout class until a future tutorial.


Objectives

The objective of Part 2 is to learn to use the SplitLayout class in conjunction with your own layout management code to dynamically change the layout of a ThinWire GUI based on the current size of the Web browser window. You'll also learn to cause the layout to be updated each time the user manually changes the size of the browser window.


Prerequisites

You will need:

  • Knowledge of event-driven programming using the Java programming language as embodied in Sun's J2SE 5.0 (see DickBaldwin.com in Resources).
  • Knowledge of how to deploy a Web application in a Java servlet container (see "Deployment of Web Applications in Jakarta Apache Tomcat 5" in Resources).

System requirements

First, download and install the ThinWire framework (see Download).

Second, you will need access to a servlet container to test your Web applications. The easiest way to do this is to install a servlet container as a localhost server (see Download and also see "Getting Started with Jakarta Tomcat, Servlets, and JSP" in Resources).

Third, download Sun's Java Development Kit (see Download).

1 of 13 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Web development, Java technology
ArticleID=185164
TutorialTitle=Build Web apps with ThinWire and Java code, Part 2: Using the SplitLayout Class
publish-date=01032007
author1-email=baldwin@dickbaldwin.com
author1-email-cc=htc@us.ibm.com

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.