ADC Home > Reference Library > Technical Q&As > Legacy Documents > Java >
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:
Technical Q&A JAVA07
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
Salad extends Component
this.setName( "Green Salad" );
In this example, you would be able to communicate with your object in
AppleScript by referring to it as
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]