title: Java - If ButtonGroup1 is not selected then show message box
body: <p>I am working on my college project, where we have to design a program for a Sandwich shop. I am stuck on one place. I want to show the message box if nothing has been selected in <code>buttongroup1</code>.</p>
  
  <p>I tried this bit of code but it doesn't seem to be working correctly:</p>
  
  <pre><code>boolean ButtonGroup1 = false;
   if (ButtonGroup1 == false)
       JOptionPane.showMessageDialog (null, "Pleace Selete the Sandwiches order" );``
  </code></pre>
  
  <p>here is the program:</p>
  
  <pre><code>private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
  
  
  /* Errors -------------------------------*/
      buttonGroup1.add(HamRButton);
      buttonGroup1.add(ChickenRButton);
      buttonGroup1.add(CheeseRButton);
      buttonGroup1.add(PorkRButton);
      buttonGroup1.add(TunaRButton);
  
      buttonGroup2.add(WaterRButton);
      buttonGroup2.add(BottleofPOP);
      buttonGroup2.add(CanofPoP);
  
      buttonGroup3.add(CheeseExButton);
      buttonGroup3.add(SaladExButton);
      buttonGroup3.add(HamExButton);
      buttonGroup3.add(TunaExButton);
      buttonGroup3.add(ChickenExButton);
      buttonGroup3.add(PorkExButton);
  
  
    boolean buttonGroup1 = false;
    if (!buttonGroup1){
     JOptionPane.showMessageDialog(null, " ");
    }
  </code></pre>