title: How to add a List of JButtons to a JFrame?
body: <p>So... I'm making a Jeopardy game, and I'm experimenting with better ways of making and adding the buttons so that it looks better in the source code. So to start off, I have a CategoryClass that takes the parameters of a List of QuestionButtons (basically a JButton), the category name and so on. The only trouble I'm having is adding the buttons to a JPanel. Here's the code:</p>
  
  <pre><code>    public void addCategoryButtons(JPanel pane) {
          JLabel head = this.getCategoryHeading();
          pane.add(head);
          List&lt;QuestionButton&gt; buttons = this.getCategoryButtons();
          for (int i = 0; i &lt; buttons.size(); i++) {
              pane.add(buttons.get(i).getButton());
          }
      }
  </code></pre>
  
  <p>And <a href="http://i.imgur.com/585Ib.png" rel="nofollow">here's</a> what I get. Note: the "Test" is the name of the category </p>
  
  <p>As you can see, It shows the last Category I add instead of all of them. Any suggestions?</p>