Connecting Components using the Connection Wizard

The LookandFeel application lets you change the graphical user interface--the look and feel--at runtime. When you make a selection, a message is sent to the SwingSet component to render itself (and the components it contains) for the new look and feel.

In this section, you work with the Connection Wizard to connect the event source (lnfSelector) to the event target (swingSet).

  1. Switch to connection mode in the Component Palette.

    Connection Mode

    Since connection mode is selected, your next two clicks determine the event source and the event target. You must click the target immediately after clicking the source.

  2. Click lnfSelector (the event source) then click swingSet (the event target) in the Component Inspector.

    The Connection Wizard - Step 1 opens. It lists all events that lnfSelector can fire.

  3. Expand the item node and select itemStateChanged. Click Next.

    The Connection Wizard - Step 2 opens.

  4. Select Method Call.

    All messages that can be sent to swingSet are listed.

  5. Find setLookandFeel in the list of methods and select it. Click Next.

    The Connection Wizard - Step 3 opens.

  6. Select Property, then click the ellipsis.

    All of lnfSelector's properties are listed.

  7. Choose selection then click OK. Click Finish.

    The Source Editor opens to show the generated code.

  8. Choose File Save All to save your work.

  9. Next:Compiling and Running a Swing Application
    Back:Adding Swing Components

    Legal Notices