Open topic with navigation
Before you extend UFT support for a custom control, you must:
Make sure you have full access to the control.
Understand its behavior and what functionality needs to be tested.
Have an application in which you can see and operate the control.
Have access to the class that implements it. (Although you do not modify any of the custom control classes when creating your custom support, you reference the compiled classes, and rely on information you can gain from the source files.)
Perform the following procedure to create an Eclipse project containing the ImageControls custom toolkit classes and a sample application containing the custom controls.
Note: The sample application is designed to run from the default <UFT Java Add-in Extensibility SDK installation>\samples folder. If you install the SDK to another location, you need to modify the sample application slightly before you begin this lesson. For information, see Modifying the Sample Application to Run From Another Location.
Run Eclipse and select File > New > Project. The New Project dialog box opens.
Select Java Project and click Next. The New Java Project dialog box opens.
ImageControls in the Project name box.
Select the Create project from existing source option.
Click the Browse button and browse to the <UFT Java Add-in Extensibility SDK installation folder>\samples\ImageControls\src folder. Click OK to return to the New Java Project dialog box.
Click Finish. A new Java project is created with the ImageControls sample source files. The new project, named ImageControls, is displayed in the Package Explorer tab.
Note: The steps for creating a new project in Eclipse may vary, depending on the Eclipse version that you use.
Expand the ImageControls project to view its content. The ImageControls\src package folder contains two packages:
The com.sample package contains the sample application: SampleApp.
The com.demo package contains three custom controls: ImageButton, ImageControl and ImageLabel.
The following diagram shows the inheritance hierarchy of the classes in the com.demo package.
The functionality provided by the classes in this package is as follows:
ImageControl. This class extends the Canvas class, and displays an image on the control.
ImageLabel. This class extends the ImageControl class, and allows writing additional text over the image displayed on the control.
ImageButton. This class extends the ImageControl class, and draws a button-like rectangle around the control. It listens for low-level events on the control, and triggers an Action event when the button is clicked.