title: How to output variable in JLabel
body: <p>I'd like to start off by mentioning this is only my 3rd week of programming and my first question here. I have an assignment where I need to have this program calculate the minimum change for a given number and display the amount of each coin after clicking the calculate button. </p>
  
  <p>My question is where do I need to place the calculations and how to get the resulting variables to output into the quarters/dimes/nickels/pennies JLabel fields on the right side of the GUI.</p>
  
  <p>package mincoinsgui;</p>
  
  <pre><code>import java.awt.*;
  import javax.swing.*;
  import java.awt.event.*;
  
  class MinCoinsGui extends JFrame
  {
  //init
  
      private static final int QUARTERS = 25;
      private static final int DIMES = 10;
      private static final int NICKELS = 5;
      private static final int PENNIES = 1;
  
      int quarters = 0;
      int dimes = 0;
      int nickels = 0;
      int pennies = 0;
      int change = 0;
  //text field
      private JTextField changeTF = new JTextField(2);
  
  //main method
      public static void main(String[] args)
      {
  //instantiate window object
          MinCoinsGui window = new MinCoinsGui();
          window.setVisible(true);
      }
  
      //contructor method
      public MinCoinsGui()
      {
          // 1. Create/initialize components
          JButton calculateBtn = new JButton("Calculate");
          calculateBtn.addActionListener(new CalculateBtnListener());
  
  //        JButton clearBtn = new JButton("Clear");
  //        clearBtn.addActionListener(new ClearBtnListener());
          changeTF.setEditable(true);
  
          // 2. Create panel panel / set grid layout
          JPanel panel = new JPanel();
          panel.setLayout(new GridLayout(6, 2, 2, 2));
  
          // 3. Add components to panel panel
          panel.add(new JLabel("Enter Change (1-99):"));
          panel.add(changeTF);
          panel.add(new JLabel("Quarters"));
          panel.add(new JTextField(quarters));
          panel.add(new JLabel("Dimes"));
          panel.add(new JTextField(dimes));
          panel.add(new JLabel("Nickels"));
          panel.add(new JTextField(nickels));
          panel.add(new JLabel("Pennies"));
          panel.add(new JTextField(pennies));
          panel.add(calculateBtn);
          //content.add(clearBtn);
  
          //set window (JFrame) characteristics
          setContentPane(panel);
          //do layout
          pack();
          setTitle("Minimum Coins");
          setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          //center window
          setLocationRelativeTo(null);
  
      }
  
      //CalculateBtnListener
      class CalculateBtnListener implements ActionListener
      {
  
          public void actionPerformed(ActionEvent e)
          {
              String dyStr = changeTF.getText();
              change = Integer.parseInt(dyStr);
              while (change != 0)
              {
                  while (change &gt;= 25)
                  { //Subtact &amp; Count Quarters
                      change = change - QUARTERS;
                      quarters++;
                  } //Subtract &amp; Count Dimes
                  while (change &gt;= 10)
                  {
                      change = change - DIMES;
                      dimes++;
                  } //Subtract &amp; Count Nickels
                  while (change &gt;= 5)
                  {
                      change = change - NICKELS;
                      nickels++;
                  }
                  pennies = change;
              }
  
          }
      }
  }
  </code></pre>