title: I need help on my Deal or no Deal Java game
body: <p>I'm trying to make a simple deal or no deal game. I haven't really progressed yet, but hopefully I can finish it. So far I have only made a JFrame with JButtons and when you click the buttons, the ammount appear. What I'm trying to do next is when you click atleast 3 of the buttons, a dialog box will appear. I don't know if this is possible, but if it is, please help me. I only have a few experience on Gui and eventhandling.</p>
  
  <p>here is my code so far:</p>
  
  <pre><code>import java.awt.*;
  import java.awt.event.*;
  import javax.swing.*;
  import java.util.Random;
  
  public class Dealornodeal2 implements ActionListener{
  
  private JFrame frame = new JFrame("DEAL OR NO DEAL");
  private JButton button1 = new JButton(" 1 ");
  private JButton button2 = new JButton(" 2 ");
  private JButton button3 = new JButton(" 3 ");
  private JButton button4 = new JButton(" 4 ");
  private JButton button5 = new JButton(" 5 ");
  private JButton button6 = new JButton(" 6 ");
  private JButton button7 = new JButton(" 7 ");
  private JButton button8 = new JButton(" 8 ");
  private JButton button9 = new JButton(" 9 ");
  private JButton button10 = new JButton(" 10 ");
  private JButton button11 = new JButton(" 11 ");
  private JButton button12 = new JButton(" 12 ");
  private String amm[]={"25,000","50,000","75,000","100,000"}; 
  int number;
  private boolean clicked = false;
  
  
  //constructor for deal or no deal
  public Dealornodeal2(){
  
      frame.setSize(500,400);
      frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      frame.setLayout(new GridLayout(3,3));
      frame.add(button1);
      frame.add(button2);
      frame.add(button3);
      frame.add(button4);
      frame.add(button5);
      frame.add(button6);
      frame.add(button7);
      frame.add(button8);
      frame.add(button9);
      frame.add(button10);
      frame.add(button11);
      frame.add(button12);
  
      button1.addActionListener(this);
      button2.addActionListener(this);
      button3.addActionListener(this);
      button4.addActionListener(this);
      button5.addActionListener(this);
      button6.addActionListener(this);
      button7.addActionListener(this);
      button8.addActionListener(this);
      button9.addActionListener(this);
      button10.addActionListener(this);
      button11.addActionListener(this);
      button12.addActionListener(this);
  </code></pre>
  
  <p>}</p>
  
  <p>//actionlistener<br>
      public void actionPerformed(ActionEvent a){</p>
  
  <pre><code>    if(a.getSource() == button1){
          button1.setText(amm[(int)(Math.random() * amm.length)]);
          button1.setEnabled(false);
  
  
      }
      else if(a.getSource() == button2){
          button2.setText(amm[(int)(Math.random() * amm.length)]);
          button2.setEnabled(false);
  
      }
      else if(a.getSource() == button3){
          button3.setText(amm[(int)(Math.random() * amm.length)]);
          button3.setEnabled(false);
  
      }
      else if(a.getSource() == button4){
          button4.setText(amm[(int)(Math.random() * amm.length)]);
          button4.setEnabled(false);
  
      }
      else if(a.getSource() == button5){
          button5.setText(amm[(int)(Math.random() * amm.length)]);
          button5.setEnabled(false);
  
      }
      else if(a.getSource() == button6){
          button6.setText(amm[(int)(Math.random() * amm.length)]);
          button6.setEnabled(false);
  
      }
      else if(a.getSource() == button7){
          button7.setText(amm[(int)(Math.random() * amm.length)]);
          button7.setEnabled(false);
  
      }
      else if(a.getSource() == button8){
          button8.setText(amm[(int)(Math.random() * amm.length)]);
          button8.setEnabled(false);
  
      }
      else if(a.getSource() == button9){
          button9.setText(amm[(int)(Math.random() * amm.length)]);
          button9.setEnabled(false);
  
      }
      else if(a.getSource() == button10){
          button10.setText(amm[(int)(Math.random() * amm.length)]);
          button10.setEnabled(false);
  
      }
      else if(a.getSource() == button11){
          button11.setText(amm[(int)(Math.random() * amm.length)]);
          button11.setEnabled(false);
  
      }
      else if(a.getSource() == button12){
          button12.setText(amm[(int)(Math.random() * amm.length)]);
          button12.setEnabled(false);
  
      }
  
  
  
  }
  </code></pre>
  
  <p>}</p>