Sizing and Moving Components

For many layouts, the layout manager determines the size of the components by constraints, making sizing in the Java Visual Editor have no effect. However, when working with null, XYLayout, or GridBagLayout, you can size components when you first place them in your UI, or you can resize and move components later.

Note: GridBagLayout currently ignores size on creation, but you can then resize components after creation.

To size a component as you add it:

  1. Select the component in the Component Palette.
  2. Place the cursor where you want the component to appear in the UI.
  3. Drag the mouse pointer before releasing the mouse button.

    As you drag, an outline appears to indicate the size and position of the control.

  4. Release the mouse button when the outline is the size you want.

To resize or move a selected component:

  1. Click the component in the Java Visual Editor or in the Structure window to select it.

    When you select a component, sizing handles or nibs, appear on the perimeter of the component. For some containers, a move handle appears in the middle of the component.

  2. Click the appropriate outer handle and drag to resize.
  3. Click anywhere in the component and drag it any direction to move it. If the component is a container that is covered with other components, use the center move handle to drag it.

To resize or move a group of selected component:

  1. Do one of the following to select the group of components to be changed:

    When you select a component, sizing handles or nibs, appear on the perimeter of the component. For some containers, a move handle appears in the middle of the component.

  2. Click the appropriate outer handle and drag to resize.
  3. Click anywhere in the component and drag it any direction to move it. If the component is a container that is covered with other components, use the center move handle to drag it.
  4. Right-click and choose Size and Space , then choose the desired operation.

    OR

    Click the desired size button in the Java Visual Editor toolbar. Operations which are invalid for the currently selected components appear disabled in the toolbar and context menu.


Determining the Size and Location of Your UI Window at Runtime