Calbutton actionListener question
Im new to Java , I don't know where to place the actionListener and actionEvents for the Calcbutton, any suggestions will be appreciated ?
package javaapplication7;
/**
*
* @author kwashing
*/
/**
*
* @author kwashing
*/
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import javax.swing.JFormattedTextField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JButton;
public class javaapplication7 extends JFrame
{
private JPanel MyPanel = null; //* Set panel to null
private JLabel LoanAmountLabel = null;
private JFormattedTextField EnterText = null;
private JLabel result = null;
private JLabel CalcResultsLabel = null;
private JLabel MortCalcLab = null;
private JLabel InterestRateLab = null;
private JFormattedTextField IntRateText = null;
private JLabel TermYearsLab = null;
private JFormattedTextField TermYearText = null;
private JButton Calcbutton=null;
/**
* This is the default constructor
*/
public javaapplication7()
{
super("Calculation Program");
initialize();
}
public static void main(String args[]){
javaapplication7 demo = new javaapplication7 ();
demo.setVisible(true);
}
// public static double fToC(double x) {
// return (x-32.0) * 5.0/9.0;
// }
/**
* This method initializes this
*
* @return void
*/
private void initialize()
{
this.setSize(500, 500);
this.setContentPane(getMyPanel());
}
private JPanel getMyPanel() {
// If tempPanel is null, than we need to create it and add the components
if (MyPanel == null) {
// A welcome label
MortCalcLab = new JLabel();
// The setBounds method can also take a rectangle! (x,y,w,h) which is an object
MortCalcLab.setBounds(new Rectangle(180, 16, 227, 28));
MortCalcLab.setText("Calculate your Mortgage");
// Result text
// The label where