Working With Java Swing JTable

Applies to TestComplete 12.60, last modified on September 17, 2018

TestComplete has the Java Control Support plugin that expands TestComplete abilities to interact with Java controls from scripts. If the plugin is installed and enabled, TestComplete extends the JTable functionality with methods, properties and actions of the JTable object. These supplementary members let you perform specific operations over JTable, for example, simulate clicks on grid cells, obtain and set values in grid cells, expand and collapse rows, and so on.

Since JTable is a Java control and can be used in Java applications, which are always “open” to TestComplete, internal methods and properties of the JTable object are also visible to TestComplete. This “openness” means that you can use JTable’s “native” methods and properties to perform needed actions as well.

Finally, you can work with JTable as with a black-box application window, that is, you can simulate various mouse actions and keystrokes, record and play back low-level procedures, and so on. For more information, see Simulating User Actions.

In order for TestComplete to have access to internal methods and properties of the JTable object and to extend the JTable functionality, both the Java Application Support and Java Control Support plugins must be installed and enabled.

The topics of this section contain information about operations commonly performed when testing applications containing Java Swing JTable. They also contain numerous sample routines which can be used in your scripts with minimum changes. The sample scripts in these topics work with the SimpleTableDemo sample application that is available at http://java.sun.com/docs/books/tutorial/uiswing/components/table.html.

In This Section

Searching for Records in Java Swing JTable

Describes how to search for a specific record within JTable.

Selecting Cells in Java Swing JTable

Describes approaches used to select individual grid cells.

Activating and Closing In-place Editors in Java Swing JTable

Explains how you can activate a cell’s in-place editor and save changes made to the cell value.

Obtaining and Setting Cell Values in Java Swing JTable

Describes how you can get and set values in individual grid cells.

Copying and Pasting Cell Values in Java Swing JTable

Describes how the cell value can be copied to or pasted from the clipboard.

Sorting Data in Java Swing JTable

Explains how you can sort data displayed in JTable.

Iterating Through Rows in Java Swing JTable

Explains how to process JTable rows in a loop and provides an example demonstrating how to save the grid contents to an XML file.

See Also

Working With Grids
Supported Java Controls
Testing Java Applications - Overview

Highlight search results