Creo™ Schematics 4.0 Help Center > Customizing Creo Schematics Using Java APIs > Example: Syntax to Call Java from Labels
  
Example: Syntax to Call Java from Labels
public class ExampleClass
{
public static String labelMethod(Shape shape, String par1)
{
return "Received shape with text" + par1;
}
}
The correct syntax to call the method labelMethod is:
{ExampleClass.labelMethod(text1)}
* 
The call specifies only one parameter because for label functions, the first parameter (the shape or sheet) is inserted in the call to the method.
If the label is a sheet label, declare the method as:
public static String labelMethod(Sheet sheet, String par1)
You can use the overloading facility of Java, using the following example:
public class ExampleClass
{
public static String labelMethod(Shape shape, String par1)
{
return "Received shape with text" + par1;
}
public static String labelMethod(Sheet sheet, String par1)
return"Received sheet with text" + par1;
}
}
Java automatically determines which method to call, depending on the type of label in which the call exists.