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.
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.
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.
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.
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.
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).
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).

