|Delphi Clinic||C++Builder Gate||Training & Consultancy||Delphi Notes Weblog||Dr.Bob's Webshop|
User interface design in Java has to be done with layout managers. These layout managers determine where components will be placed. Most layout managers use the getPreferredSize(), getMinimumSize(), getMaximumSize() to determine the size of the components. Besides these sizes most layout managers have got properties for horizontal and vertical gap distance between components. But maybe we want some more freedom to determine the spacing between components, but do not want to exclude the use of the layout managers.
And that is were the borland.jbcl.view.Spacer class comes into play. This class is a component we can set the preferredSize, minimumSize, maximumSize properties of. The layout manager will use these values to layout the different components.
So all we have to do is to add the Spacer component to our application and change the size properties. And because this component is a real component we can add it to our Component Palette and drop it on our panels in the Visual Designer.
Follow these steps to add the component to the Component Palette:
Once it is on the Component Palette we can drop it on our panels in the Visual Designer. The following applet shows the use of the Spacer component. By clicking the button a new frame will be opened which allows us to experiment with different spacer sizes.