ADC Home > Reference Library > Technical Q&As > Legacy Documents > Java >

Legacy Documentclose button

Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.

Current information on this Reference Library topic can be found here:

AppleScript for Java

Q: When I am scripting my Java application, I find it inconvenient to refer to objects as "object 1 of Frame 1". Is there any way to assign formal names to objects?

A: Yes. If you call java.awt.Component.setName() from your object in your Java source code, you can assign a more user-friendly name than the identifier generated by AppleScript for Java

public class
Salad extends Component
   public Salad()
      this.setName( "Green Salad" );

In this example, you would be able to communicate with your object in AppleScript by referring to it as Salad "Green Salad". This makes your "Green Salad" easier to distinguish from your "Caesar Salad" than would be possible if you used the default naming nomenclature, Salad 1, Salad 2, etc.

[May 17 1999]

Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.