"JavaFX 1.2 UI Control Components: Part 1, Layouts" by Robert Eckstein, java.sun.com senior staff writer, discusses the new user interface (UI) control components that are features of JavaFX SDK 1.2. He explains that these components replace those in earlier versions that were derived from Swing and that limited users to the desktop profile. The new control components, Eckstein writes, enable developers to create more compelling graphical capabilities with the JavaFX scene graph.
Eckstein outlines the classes in JavaFX 1.2 that developers can use to lay out UI control components. In addition to the HBox and VBox that were included in JavaFX 1.0, there are now four others:
- Flow: The Flow container lays out its content nodes in either a horizontal or vertical flow, wrapping at the appropriate boundary. It is similar to the AWT FlowLayout, except that it can work vertically as well.
- Stack: The Stack container arranges its content nodes in a back-to-front stack. It is similar to the AWT CardLayout.
- Tile: The Tile container lays out its content nodes in uniformly sized layout spaces or "tiles". Tile supports both horizontal (default) and vertical orientations.
- ClipView: ClipView is a container which acts as a clipping view of its contents, responding to mouse events by panning the clipped region.
Eckstein refers readers to an earlier JavaFX article, "What's New in JavaFX 1.2 Technology," where these classes are discussed in greater detail.
Continuing his discussion of the four new classes, Eckstein provides code samples and screen shots involving each of them. He then proceeds to the need for JavaFX to adjust the size of children objects in cases of resized layouts if the children objects are to fit within the necessary bounds. He demonstrates how using a button rather than a text inside the layout of the Stack example solves this problem.
Eckstein explains that each control class from the JavaFX 1.2 package has its own notion of a preferred size that it uses to resize UI controls inside a layout. This, he says, can be corrected by specifying a preferred size for any JavaFX node, and he provides the code with which to do this.
More Information
Powerful UI Capabilities with Node-Based Controls
What's New in JavaFX 1.2?
JavaFX 1.2 Technology: Features and Enhancements
[...read more...]
Other articles in the JavaFX section of Volume 144, Issue 3:
A Glance at the New UI Layout Control Components in JavaFX 1.2
(this article)
See all archived articles in the JavaFX section.
|
|
Top 10 Most Popular Articles in Current Issue (Vol 168, Issue 1)
|
|
|
|
|