Relatively Positioning Web UI Components
By divas on Aug 21, 2007
This tip is applicable to NetBeans IDE (versions 5.5.1 and 6) and the Sun Java Studio Creator IDE
If, when using the Visual Designer in a Visual Web application (grid layout), you want to position a component relative to the width of the browser so that when the user widens or shortens the browser, the component moves relatively, try the following steps:
- Select the component.
- In the Properties window, click the ellipsis (...) button
for the Style property.
- In the Style dialog box, select Position.
- In the Position section, set the Mode to Relative.
- Set either the Right or Left value to a number, such as 30. This value is the percent of the browser width to the right or left of the component, respectively. For example, a Left value of 30 will place the component's left side 30% in from the left.
- Select % from the drop-down list for the value that you just entered.
- For the opposite side, select <Not Set> from the drop-down list. For example, if you set the Left to 30%, select <Not Set> from the drop-down list for Right
- Click OK.