Panel Nesting and Component Positioning
What BulletProof has created with JDesignerPro is entirely unique. JDesignerPro has been designed to allow visual design of Java application components and JavaBeans while retaining the cross-platform qualities of the Java platform. This is done through the use of panels.
At the root of all screens built with JDesignerPro are Panels, which is an objects in the Objects Tree. A Panel is a virtual space on which other objects are placed. These panels are invisible with no borders. You add one by simply dropping it on the screen or on another panel in the Layout View.
Imagine building a collage with pictures and text laid next to and on top of each other. Laying out components in JDesignerPro is similar to making a collage where the components and panels are the pictures and text. Objects and panels are not placed at absolute x,y positions. Rather they are placed in relation to each other. The Layout properties of the panels determine the location of each. JDesignerPro employs only the pure Java layout managers for cross platform compatibility. We think you will find it enjoyable and efficient to work with.
The purpose of the Panel object is to carry components and allow their placement to be manipulated. To lay out a screen, you place panels within other panels. Then you will place objects on top of those panels. Placing panels within panels in this manner is referred to as nesting. If you nest a panel within a panel so that the second panel is in the lower right of the screen, then a component placed on the second panel will appear in the lower right. It is common to have several panels nested. These nested panels add very little overhead to the code of the final product.
The benefits of nesting are two fold. First, this method of laying out panels according to positioning and Layout Managers is the only way to create a truly cross-platform application.
Second, nested panels act as a way of breaking up the GUI into distinct areas. These distinct areas are for you to place your components where you want them. For example, lets say we want to place two buttons in the lower right corner of a screen. Here is one way to do that, by splitting the Main panel into Grid Layouts then adding a Flow Layout with its position set to South:
Some components do not require as much nesting. To place a Chart or Detail Grid data component, you would not need the extra Grid Layout and Flow Layout panels. This is because the Chart or Detail Grid would automatically acquire the entire space of the Main panels section into which you placed it. You would want a Chart or Detail Grid to be large enough to be practical for use.
The screen shot below illustrates how you might place two buttons on the bottom of your screen using a combination of panels. If you look at the Layout View you will notice 4 panels occupying different positions on the Main panel. The panel that is south has a Layout of FlowLayout and has two buttons placed on it.
To add other objects to this screen such as fields, search panels, grids, etc., you would place them on Panel1, 2 and 3. You could also add additional objects to Panel4.
For more examples on panel and component position open each of the examples that are provided in the Applications\Examples directory that comes with JDesignerPro.
This much nesting is not usually required. Some nesting is required for exact placement of smaller components. This amount of nesting and panel usage may appear at first to be a lot of extra effort. You will find that it is not. In the end, the you will save a substantial amount of time by learning and using the JDesignerPro Application Builder and panel nesting.
Learn more about Panel Layout Types.