How to get the right component name and then use it in FEST testing

146 views Asked by At

I am using setname to define buttons in my Swing applcation. I want to use the names in my FEST code. This is the source code:

for (int i = 0; i < trimSizeButtons.length; ++i) {
    trimSizeButtons[i].setActionCommand(
        trimSizes[i].getDisplayName
    trimSizeButtons[i].setName(trimSizes[i].getDisplayName());

What then is the result of the names here so that I can use in my fest code?

1

There are 1 answers

0
Alderath On

That is impossible to answer with the given information. trimSizes is an array of objects of some type. Those objects (most likely) have an instance variable named displayName. From the code snippet you posted, it is impossible to know what these variables contain.

You could try adding System.out.println("Name of button " + i + " is: " + trimSizes[i].getDisplayName()); to the for loop you posted. This would make the application print the names of all trimSizeButtons to the standard output stream when the application is run.