To set a component's size, grab one of its corners or edges and drag it to the desired size. Many components automatically expand in size to accommodate any text and icons that are inserted into them. Another important function is setting components to be the same size. For example, a form could have the standard OK, Cancel, and Help buttons. By default, each button would only be as wide as its containing text. The form looks much better, however, when you set all three buttons to be the same width. To set multiple components to be the same size:
To set a component to automatically resize as its container resizes, do one of the following:
Figure 6-5 shows all of these concepts at work together. The two JLists must have the same width and automatically resize both vertically and horizontally when you resize the dialog. To achieve this state, do the following:
Figure 6-5. Two JList components set to be the same size and resize automatically
|