title: GuessGame can't get program to output messages
body: <p>I got the widow and the buttons into the GUI but for the life of me I can't get anything to output. I am suppose to enter a guess, and from a random number the game generates. It is suppose to tell me if I'm too high, too low or correct. Also, if it is not correct it's supposed to tell me if I am warm or cold. If any one could point me in the right direction on this I would be grateful. I don't know what I'm doing wrong on this. I have researched different topics but with the different ways to solve this problem none match what I was looking for.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>//all necessary imports
  
  public class GuessGame extends JFrame 
  {
      private static final long serialVersionUID = 1L;
      private JFrame mainFrame;
      private JTextField guessField;
      private JLabel message1;
      private JLabel message2;
      private JLabel message3;
      private JLabel message4;
      private JLabel guessLabel;
      private JLabel tooHigh;
      private JLabel tooLow;
      private JButton guessButton;
      private JButton newGame;
      private JButton exitButton;
      private int randomNum = 0;
      private final int MAX_NUM = 1000;
      private final int MIN_NUM = 1;
      private int guessCount;
      private int lastDistance;
  
      public GuessGame()
      {
          mainFrame = new JFrame();
          guessField = new JTextField(4);
          message4 = new JLabel("I have a number between 1 and 1000 -- can you guess my number?") ;
          guessLabel = new JLabel("Please Enter Your Guess:");
  
  
          guessButton = new JButton("Guess");
          newGame = new JButton("New Game");
          exitButton = new JButton("Exit");
  
          Container c = mainFrame.getContentPane();
          c.setLayout(new FlowLayout());
          c.setBackground(Color.CYAN);
  
          c.add(message4);
          c.add(guessLabel);
          c.add(guessField);
          c.add(guessButton);
          c.add(newGame);
          c.add(exitButton);
  
          newGame.setMnemonic('N');
          exitButton.setMnemonic('E');
          guessButton.setMnemonic('G');
  
          mainFrame.setSize(420, 300);//Sets width and height of Window
          mainFrame.setVisible(true);//Allows GUI to be visible
          mainFrame.addWindowListener(new WindowAdapter()
  
          {
              public void windowClosing(WindowEvent e)
              {
                  System.exit(0);
              }
          });
  
          GuessButtonsHandler gHandler = new GuessButtonsHandler();
          guessField.addActionListener(gHandler);
  
          ExitButtonsHandler eHandler = new ExitButtonsHandler();
          exitButton.addActionListener(eHandler);
  
          NewGameButtonsHandler nHandler = new NewGameButtonsHandler();
          newGame.addActionListener(nHandler);
      }
  
      class GuessButtonsHandler implements ActionListener
      {
          @Override
          public void actionPerformed(ActionEvent e)
          {
  
              Random rand = new Random();
  
              int guess = 0;
              int currDistance = 0;
              boolean correct = false;
              guess = Integer.parseInt(guessField.getText());//Converts String to Integer
  
              if(guessCount == 0)
              {
                  lastDistance = MAX_NUM;
              }
  
              if(guess &gt;= MIN_NUM &amp;&amp; guess &lt;= MAX_NUM)
              {
                  guessCount += 1;
              }
  
              if(guess &gt; randomNum)
              {
                   tooHigh.setText("Number To High!!!");
                   guessCount += 1;
              }
  
              else if(guess &gt; randomNum)
              {
                   tooLow.setText("Number To Low!!!");
                   guessCount += 1;
              }
  
              else 
              {
                  correct = true;
                  message2.setText("Correct!!!");
                  message2.setBackground(Color.GREEN);
                  guessField.setEditable(false);
              }
  
              if(!correct)
              {
                  currDistance = Math.abs(guess - randomNum);
              }
  
              if(currDistance &lt;= lastDistance)
              {
                  message3.setText("You are getting warmer!!!");
                  mainFrame.add(message3).setBackground(Color.RED);
  
              }
  
              else
              {
                  message4.setText("You are getting colder!!!");
                  mainFrame.add(message4).setBackground(Color.BLUE);
              }
  
                  lastDistance = currDistance;
                  randomNum = rand.nextInt(1000) + 1;
          }
  
      }
  
      class NewGameButtonsHandler implements ActionListener
      {
          public void actionPerformed(ActionEvent e)
          {
              Random rand = new Random();
              randomNum = rand.nextInt(1000) + 1;
              guessCount = 0;
          }
      }
  
      class ExitButtonsHandler implements ActionListener
      {
          public void actionPerformed(ActionEvent e)
          {
              System.exit(0);
          }
      }
  }
  
  public class GuessGameTest {
  
      public static void main(String[] args) 
      {
          new GuessGame();
      }
  }
  </code></pre>