试图找出如何从数组中提取并使用JTextArea显示它

时间:2017-07-17 05:23:03

标签: java arrays jtextarea

我正在试图弄清楚如何从问题列表中提取,然后使用JTextArea输出它们。现在,我一直试图弄清楚如何从列表中随机选择然后输出它。这就是我到目前为止所做的。

 private getSalesUrl<TServiceInput>(serviceCall: (args: TServiceInput) => JQueryPromise<IServiceResponseT>, args): JQueryPromise<any> {
        serviceCall(args).done(result => {  //1st async call
            if (result.serviceOutput) {
                if (result.serviceOutput.key === "URL") {
                    return tipsInterop.executeSalesRequest(result.serviceOutput.value);  //2nd async call
                }
            }
        });
    }

1 个答案:

答案 0 :(得分:0)

迭代数组并在JTextArea中显示

public static void Question()
  {
    String[] quest = {"place", "hold", "er"};
    int[] questNum = {1, 2, 3};

    String textContent = new String();
    for (int i = 0; i < quest.length; i++) {
     textContent += quest[i] + " ";
    }

    for (int i = 0; i < questNum.length; i++) {
     textContent += questNum[i] + " ";
    }

    JTextArea question = new JTextArea(6, 20);
    question.setText("Question " + textContent);
  }