Creo™ Schematics 4.0 Help Center > Customizing Creo Schematics Using Java APIs > Example: Defining and Invoking a Method
  
Example: Defining and Invoking a Method
Defining the Method
The sample class LabelFunctions is specified in the Java directory as follows:
// LabelFunctions.java
// A class that provides static methods that
// can be used by the Java label function.
import rsdesigner.component.*;
import rsdesigner.design.*;
import java.util.*;
public class LabelFunctions
{
public static String test_shape_label(Shape rsd_shape, String data)
{
return "Shape" + data;
}
public static String test_sheet_label(Sheet rsd_sheet, String data)
{
return "Sheet" + data;
}
}
Invoking the Method
If you invoke the method test_shape_label using LabelFunctions.test_shape_label(data1) for a shape label, the method returns the value Shape_data1.
If you invoke the method test_shape_label using LabelFunctions.test_shape_label(data2) for a shape label, the method returns the value Shape_data2.