Sun Java Studio Creator 2 – Online Help
 

Adding and Managing Code Clips

See Also

Code clips are snippets of code in the Code Clips tab of the Palette   that you can use in your applications. You can insert a code clip into code that is open in an IDE source editor, such as the Java Editor or the JSP Editor. You can also add new code clips to the Palette from any editor. In addition, you can rename, edit, or delete code clips in the Palette.

The Code Clips tab has the following categories:

To use a clip in your code:

  1. Open your code in the Java Editor or the JSP Editor, depending on the type of code clip and where you want it to go.
     
  2. Position the cursor in your code where you want the code clip to be inserted.
     
  3. In the Palette, select the code clip and then use one of the following techniques to add it to your code:
    • Drag the code clip to the location where you want it in the source editor.
       
    • Right-click the code clip and choose Add to Source.
       

     

To add a clip to the Palette:

  1. In the Code Clips tab of the Palette, right-click the category where you want to add the clip and choose New Clip.
     
  2. In the Code Clips Editor, type the text.
     
  3. Click Save Changes.
     
  4. If desired, rename the code clip.
     

To rename a clip:

  1. In the Palette, right-click the code clip and choose Rename.
     
  2. In the Rename Code Clips dialog box, type the new name and click OK.
     

To edit a clip:

  1. In the Palette, right-click the code clip and choose Edit.
     
  2. In the Code Clips Editor, edit the text and click OK.
     

To delete a clip:

To add a category to the Code Clips tab:

  1. Right-click any category and choose Create New Category.
     
  2. Enter the name of the new category in the New Palette Category dialog box, and then click OK.
     

To delete a category from the Code Clips tab:

  1. Right-click the category you want to delete and choose Delete Category.
     
  2. When the delete confirmation dialog box appears, click Yes.
     
See Also
About Components
Component Tasks: Quick Reference
 
 
 
Legal Notices. Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Close