Manipulating Beans Visually

Once you have placed beans on the free-form surface, you can make the following changes to achieve the look and function you want:

Selecting and Deselecting Beans

To select a single bean, click the bean with mouse button 1. If you previously selected other beans, they are deselected automatically.

To select multiple beans, do one of the following:

You can select beans or connections, but not both together. However, if you delete a bean with connections, the Visual Composition Editor deletes the connections and the bean.

When you select a bean in the Visual Composition Editor, selection handles Selection Handle appear on the corners and between the corner handls. If you select more than one bean, the last bean selected has solid selection handles, indicating that it is the anchor bean and the other selected beans have hollow selection handles. The anchor bean is the guide by which the other beans are manipulated. For example, if you want to match the widths of two beans, the anchor bean is used as the guideline width.

To change the anchor bean, hold Shift and click the already selected new anchor bean.
Note:You can also select and modify beans, one at a time, in the beans list.

To deselect a bean after you have selected it, click mouse button 1 anywhere on the Visual Composition Editor.

To deselect multiple but not all selected beans, follow these steps:

  1. Hold down the Ctrl key.
  2. Click and release mouse button 1 on all the beans you want to deselect.

You can deselect all selected beans by clicking mouse button 1 anywhere but on a selected bean.

Positioning Beans

Positioning a bean refers to aligning or spacing. For beans in a null layout, the tool bar and the Tools pull-down menu provide options for aligning beans.

The anchor bean, indicated by solid selection handles, is the bean that serves as the alignment reference. To align beans with one another, select the ones you want to modify and select the anchor bean last. You can also change the anchor bean by holding Shift and clicking on the new anchor bean.

To align beans:

  1. Select all the beans you want to align, and then select the bean you want the others to match.
  2. Select one of the following alignment tools from the tool bar:

    Align Left Align Left

    Align Top Align Top

    Align Center Align Center

    Align Middle Align Middle

    Align Right Align Right

    Align Bottom Align Bottom

The pop-up menu provides options for spacing within the bounding box, an unseen box that contains the selected beans. You can also manage the placement of parts by using a layout managerh.

To space beans within the bounding box:

  1. Select all the beans you want to evenly space. You must select a minimum of three beans.

  2. From the pop-up menu of one of the selected beans, select Layout and then Distribute, and then either Horizontally in bounding box or Vertically in bounding box.

Note:If you specify a non-null layout for the container, the bean alignment and spacing are controlled by that layout manager and not the alignment tools.

Resizing Visual Beans

You can change the size of a visual bean in the Visual Composition Editor using any of the following techniques:

Beans that cannot be resized, such as variables, menus, and tear-off properties have reversed background color, but no selection handles. Beans using non-null layouts cannot be resized, but have selection handles.

Note:If you specify a non-null layout for the container, the bean sizing is affected by that layout manager.

Resizing Beans by Dragging

To change the size of a visual bean in a container using a null layout, follow these steps:

  1. Select the bean by clicking it with mouse button 1. To size several beans at once, select all the beans you want to size.

  2. Place the mouse pointer over one of the handles and hold down mouse button 1.

  3. While holding down mouse button 1, drag the handle to a new location. As you move the mouse, the outline of the bean dynamically changes size. When it is the size you want, release the mouse button. The bean changes to the size that you chose.
Note:Pressing the Esc key before releasing the mouse button cancels resizing without making changes.

To size a bean in only one direction, press and hold the Shift key while sizing the bean. Holding down the Shift key prevents one dimension of the bean from changing when you resize the other dimension. For example, to change the width of a bean but prevent its height from changing, hold down the Shift key while changing the width.

Matching Bean Sizes Using the Tool Bar

  1. Select all the beans you want to size, making sure the last bean you select, the anchor, is the size you want the others to match. You can change the anchor by holding Shift and clicking the new anchor.
  2. Select one of the following from the tool bar or the Tools pull-down menu:

    Match Width Match Width

    Match Height Match Height

    The size of the selected beans changes to match the size of the anchor bean.

Moving Beans

To move a bean in the Visual Composition Editor, follow these steps:

  1. Place the mouse pointer over the bean you want to move.

  2. Hold down the appropriate mouse button and move the mouse pointer to the new location.

  3. Release the mouse button. The bean appears in its new location with a solid border around it, indicating it is selected.

If the bean you are dragging is one of several that you selected, all selected beans move together. Pressing the Esc key before releasing the mouse button cancels the move without making changes.

You can reorder or reparent a bean in the beans list. To reorder, select a bean in the beans list and drag it to a new position within its composite bean. This action does not change the position of the bean in the Visual Composition Editor (except as noted below), but reorders the list, which affects the tabbing order. To reparent a bean, select and drag it to a different composite bean in the beans list. This action does change the position of the bean in the Visual Composition Editor. You cannot, however, select multiple beans on the beans list.

To modify bean placement on the Visual Composition Editor from within the Beans List window without reparenting, open the Properties for the bean and modify the Constraints.
Note:If you use BoxLayout, FlowLayout, or GridLayout managers, you can move beans on the Visual Composition Editor surface by reordering them in the beans list.

Moving a composite bean requires special handling. For information, see Code Generated from Visually Composed Beans.

Copying Beans

To copy beans using the clipboard:

  1. Select all the beans you want to copy.
  2. From the Edit pull-down menu, select Copy. A copy of each selected bean is placed on the clipboard.
  3. From the Edit pull-down menu, select Paste. The mouse pointer turns into a crosshair, indicating that it is loaded with the copied beans.

    If you decide against pasting the beans, unload the mouse pointer by selecting the Selection Tool Selection tool.

  4. Position the mouse pointer where you want the beans to be copied.
  5. Click mouse button 1. Copies of the beans appear at the position of the crosshair.

As long as you do not copy another item to the clipboard, you can continue copying these beans.
Note:When you copy or cut and paste beans, the Visual Composition Editor preserves the bean names but not the connections.

When you copy or cut and paste two or more beans, they retain their positions relative to each other.

To copy beans by dragging:

  1. Select all the beans you want to copy. If you only want to copy one bean, you do not have to select it.
  2. Position the mouse pointer over one of the beans you want to copy.
  3. Hold down both the Ctrl key and the appropriate mouse button.
  4. Move the mouse pointer to a new position. To help you with positioning, an outline of the bean appears. When you are copying multiple beans, the outlines of the selected beans move together as a group.
  5. When the beans you are copying are in the desired position, release the mouse button and Ctrl key. The copied beans appear where you positioned the outline.
Note:Pressing the Esc key before releasing the mouse button cancels copying without making changes.

Copying a composite bean requires special handling. For information, see Code Generated from Visually Composed Beans.

Deleting Beans

To delete beans, select them and press Delete or select Delete from the pop-up menu.

When you delete a connected bean, the connections between that bean and other beans are also deleted. However, when you select Edit and then Undo, you restore the deleted bean and any connections that were removed.

Displaying Bean Pop-Up Menus

To see a menu of operations you can perform on a bean, click mouse button 2 on the bean. The pop-up menu for the bean appears. Choices on the pop-up menu allow you to delete the bean, rename it, and perform other operations (which vary, depending on the bean).

To display a pop-up menu for multiple beans:

Note:When you open a pop-up menu for multiple selected beans, one menu displays the choices common to all selected beans. Operations performed from that pop-up affect all selected beans.


Related concepts
Setting Tabbing Order
Layout Managers in Visual Composition
Tearing Off Properties
Property-to-Property Connections
Beans Palette

Related procedures
Setting Layout Properties during Visual Composition
Opening the Property Sheet for a Bean
Changing Bean Size and Position

Related references
The Tool Bar in Visual Composition
Align Left
Align Center
Align Right
Align Top
Align Middle
Align Bottom
Vertically In Bounding Box
Horizontally In Bounding Box
Set Tabbing
Morph Into
Morph Into
Tear-Off Property