title: I want to display a message showing what I selected (Java)
body: <p>I'm doing a project (something like a restaurant) for collage, and I'm not very good in Java (they didn't really try to teach us). The principle of the project is to show a message saying what radio buttons and check boxes I've selected.</p>
  
  <p>I have 5 radio buttons, they are for selecting a meal, and 5 check boxes for selecting a side dish. I've managed to have the radio buttons work but I don't know how to make the check boxes work...</p>
  
  <p>This is the code for the radio buttons (this goes for all 5):
  <pre><code> private void jRadioButton1ItemStateChanged(java.awt.event.ItemEvent evt) {<br>
          if (evt.getSource().equals(jRadioButton1))
          {
              Meal= jRadioButton1.getText(); //Meal is a String
          }
  </pre> </code></p>
  
  <p>I tried the same code for the check boxes but it only shows one side dish in the message, even though I selected multiple...</p>
  
  <p>The code for the button that shows the message:
  <pre> <code>private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {<br>
          JOptionPane.showMessageDialog(rootPane, "You have chosen:\n" + String.valueOf(Meal) + "\n" + String.valueOf(SideDish));
      }
  </pre></p>
  
  <p>So basically, if anyone is willing to help, please tell me how to make the check boxes work... that every selected check box is shown in the message, like this:
  <pre>You have chosen:
  Pizza //meal
  Ketchup //selected side dish #1
  Chilli peppers //selected side dish #2
  Feta cheese //selected side dish #3
  </pre></code></p>
  
  <p>I hope my question is clear...</p>