Testing JFC Components: Testing a Complex Component


To try a more complex component, take a look at the sample tree that is in SwingSet. Verify that the main root of the tree has more than one child. To do this, start a recording, locate the tree, then use the edit facility of the Record/Playback window to get the component.

  1. Record a new script. Name it testTree.

  2. Select the tabbed pane "TreeView" on the SwingSet applet.

  3. Return to the Record/Playback window. Click Edit. The script editor will appear in the window.

  4. Select Insert reference from the bottom of the panel.
    A dialog appears. This dialog lets you create a variable name, then select the component you'd like to reference.

  5. Name the variable by typing its name in the Name text field. Call it theRoot.

  6. Select the component by returning to the applet and selecting the top of the tree, "Music."
    You see the component appear in the reference window.

  7. In the Reference window, click Apply, and Close.
    This inserts the code to get the component in the top of the play() method of the script.
    This is the code that is generated:

  8. Add the code to do the check. Place it beneath the reference.

  9. Compile the code. When the compile succeeds, Save the script.

  10. Click Continue to close the editor.

  11. Stop the recording.

  12. Playback the script.

You can continue, if you'd like, testing any of the JFC components found in the SwingSet.




Send feedback to JavaStar-feedback@suntest.com
Copyright © 1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, CA 94303. All rights reserved.