-2

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?

4

1 回答 1

0

这是不可能用给定的信息来回答的。 trimSizes是某种类型的对象数组。这些对象(很可能)有一个名为 displayName 的实例变量。从您发布的代码片段中,不可能知道这些变量包含什么。

您可以尝试添加System.out.println("Name of button " + i + " is: " + trimSizes[i].getDisplayName());到您发布的 for 循环中。这将使应用程序在运行时将所有 trimSizeButtons 的名称打印到标准输出流。

于 2012-01-22T21:33:44.863 回答