循环以将组件添加到JPanel

时间:2016-04-22 16:25:03

标签: java arraylist jpanel

我需要创建一个循环来通过firstResults和latestResults并添加第一个'每个组件到我的_resultsPanel JPanel,但我不知道如何为此做一个正确的循环。

public void displayResults(Practice pr) {
    _resultsPanel.removeAll();
    ArrayList<TestResult> firstResults = pr.firstResults();
    ArrayList<TestResult> latestResults = pr.latestResults();

    // this is my attempt at the loop 

for( int i = 0; i < pr.firstResults().size() && i< pr.latestResults().size();i++){
        firstResults.get(i);
        latestResults.get(i);
            System.out.println(i);


        // TODO Choose an appropriate loop to go through both firstResults and latestResults and add the i-th component of each to the results panel
    }

0 个答案:

没有答案