Tracker and TrackerPanel
Figure 3. Tracker Application
![]()
The Tracker application includes the following elements:
TrackerPanel
Some useful tracker panel methods are shown in Listing 7.
Listing 7. TrackerPanel Methods
|
public void addTrack(TTrack track); // tracks may also be added using addDrawable() |
If a tracker panel has two tracks with the same name, the getTrack() method returns the first one added.
The setMagnification() method magnifies the video image by the specified factor for more accurate marking with a mouse. TrackerPanel implements Scrollable and is typically placed in a ScrollPane so the entire image can be viewed even when magnified.
Selecting a track identifies it as the target for mouse and keyboard input. For example, a track must be selected in order to mark its steps with the mouse.
Selecting a point typically displays its coordinates or other data on Tracker's toolbar. The point's track is also selected.
Tracker
The Tracker class constructs a fully functional Tracker with frame, panels, menubars, toolbars and mouse handler as shown in Figure 3. Tracker's constructors and public methods are shown in Listing 8.
Listing 8. Tracker Methods
|
// constructors // instance methods // main method |
Customizing Tracker
Figure 4. BallApp: A Custom Application

The easiest way to customize Tracker is to open/create the desired video and tracks, save them in an xml data file (see Saving Tracker Data), and then open the saved data file in the main method of a custom application. Listing 9 shows the main() method of BallApp, an application that opens the xml file "Ball.trk" located in the "data" folder. The application opens the video and creates a "ball" track that is ready to mark as shown in Figure 4. Note that the bottom tab identifies the open data file.
Listing 9. BallApp
|
public static void main(String[] args) { |
Listing 10 shows another way to accomplish the same thing without a data file. In TrackerBallApp, the main method opens Tracker with a video in an untitled tab, sets the video clip properties, and adds the "Ball" point mass track. It also selects the ball so it is ready for marking.
Listing 10. TrackerBallApp
|
public static void main(String[] args) { // create a video // create tracker with the video and get the tracker panel // set start frame and step size of the video clip // add a point mass track and select it for marking // show the frame |
Figure 5 shows a screenshot of TrackerBallApp. It looks identical to BallApp except that the tab is untitled and Ball is capitalized.
Figure 5. TrackerBallApp: A Custom Application
![]()