title: More efficient way to add multiple button groups
body: <p>I am trying to make a personality quiz in java using the swing library. There are 5 questions that each have 3 possible answers. Right now I'm building the interface but I'm struggling to add multiple groups of buttons to my createComponents method. </p>
  
  <p>So for the sake of clarity and making it easier to read, I made a separate method for my first question text. That has been added no problem. But I run into issues with the button groups. I didn't want to load up my createComponents method with multiple lines and lines and lines of repetitive add Buttongroups stuff because I read that excluding comments, methods should be 15 lines long max. or at least for a beginner. </p>
  
  <p>So I made a separate method for my button groups which I then tried to add to the createComponents method. this gave me an error saying there is no suitable method to add a button group to my container.</p>
  
  <p>Right now I am writing multiple lines of code in my createComponent method so that I can 'correctly' add my radio buttons. I'm only on the first question and already have 16 lines in my method. there's a better, more efficient way right? </p>
  
  <pre><code>private void createComponents(Container container){
  
      BoxLayout layout = new BoxLayout(container, BoxLayout.Y_AXIS);
      container.setLayout(layout);
  
      JLabel text = new JLabel("this is the intro text");
      container.add((text), BorderLayout.NORTH);
  
      container.add(QuizIntro());
      container.add(QuestionOne());
      container.add(QuestionOneGroup());
  // this throws an error
  
      JRadioButton int1 = new JRadioButton("This is answer choice 1");
      JRadioButton ent1 = new JRadioButton("This is answer choice 2");
      JRadioButton jb1 = new JRadioButton("This is answer choice 3");
      ButtonGroup group = new ButtonGroup();
      group.add(int1);
      group.add(ent1);
      group.add(jb1);
      container.add(int1);
      container.add(ent1);
      container.add(jb1);
  // this is the 'correct' way I've been doing it. 
  }
  
  public ButtonGroup QuestionOneGroup(){
  
      JRadioButton int1 = new JRadioButton("This is answer choice 1");
      JRadioButton ent1 = new JRadioButton("This is answer choice 2");
      JRadioButton jb1 = new JRadioButton("This is answer choice 3");
      ButtonGroup group = new ButtonGroup();
      group.add(int1);
      group.add(ent1);
      group.add(jb1);
      return group;
  // this is the method I made to add a buttongroup and make my createComponent easier to read. 
  }
  </code></pre>
  
  <p>So my expected output is just a barebones window with the question and the 3 possible answer choices but I get an error telling me no suitable method. it says "argument mismatch buttongroup cannot be converted to popup menu or component". </p>