Understanding the Basics of the ImageButtonCS Class

The UFT Java Add-in Extensibility wizard creates the custom support class based on the specifications you entered, and registers it in the toolkit support configuration file.

The two most basic characteristics of a support class are:

Open ImageButtonCS.java to review the support class that the wizard created for ImageButton.

The first declaration reflects your selection in the wizard to extend the CanvasCS class:

public class ImageButtonCS extends CanvasCS implements ActionListener {
    private static final String DEBUG_IMAGEBUTTONCS = "DEBUG_IMAGEBUTTONCS";

Note: DEBUG_IMAGEBUTTONCS is defined to control printing log messages. For more information, see Logging and Debugging the Custom Support Class.

The to_class property, implemented by the to_class_attr method, defines the test object class selected to represent this custom control. UFT decides the set of identification properties and test object methods for the test object based on this mapping.

    public String to_class_attr(Object obj) {
        return "JavaButton";

This implementation is sufficient to provide initial recognition of the custom control in UFT.