QUOTE(BigAnt @ 12 Sep, 2008 - 01:31 PM)

you have to import ActionEvent:
import java.awt.event.ActionEvent;
Also when you do the calculations the Jlabels you have to use the getText() method to get the value of the labels and then parse it to the correct type to use in the calulations
Also in the action method you reference the variable monthly in the else statement when it is initialized in the first if statement, meaning it hasn't been initialized in the else statement
Like this one???CODE
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author japh
*/
public class LoanInfo extends JFrame implements ActionListener{
JPanel mainPanel;
JPanel mpl;
JPanel pnl;
JPanel panel;
JPanel Lbuttons;
JLabel name;
JLabel amount;
JLabel months;
JLabel interest1;
JLabel lbl;
JButton monInt;
JButton monPay;
JLabel rate;
JTextField atxt;
JTextField text;
JTextField mtxt;
JTextField interest;
//set up GUI components
private void launchFrame(){
setTitle("Loan Index");
setDefaultCloseOperation(EXIT_ON_CLOSE);
setLocationRelativeTo(null);
setResizable(false);
name= new JLabel("Name: ");
text= new JTextField(25);
amount= new JLabel("Amount: ");
atxt= new JTextField(10);
months=new JLabel("Number Of Months To Pay: ");
mtxt= new JTextField(4);
interest1=new JLabel("Interest: ");
interest=new JTextField(5);
rate=new JLabel("%");
lbl=new JLabel("Compute for: ");
monInt=new JButton("Monthly Interest");
monPay=new JButton("Monthly Payment");
mainPanel=new JPanel(new BorderLayout());
pnl= new JPanel(new FlowLayout(FlowLayout.RIGHT));
mpl=new JPanel(new FlowLayout(FlowLayout.LEFT));
panel=new JPanel(new FlowLayout(FlowLayout.LEFT));
Lbuttons=new JPanel(new FlowLayout(FlowLayout.CENTER));
pnl.add(amount);
pnl.add(atxt);
pnl.add(months);
pnl.add(mtxt);
mpl.add(name);
mpl.add(text);
panel.add(interest1);
panel.add(interest);
panel.add(rate);
Lbuttons.add(lbl);
Lbuttons.add(monInt);
Lbuttons.add(monPay);
mainPanel.add(pnl,BorderLayout.WEST);
mainPanel.add(mpl,BorderLayout.NORTH);
mainPanel.add(panel,BorderLayout.EAST);
mainPanel.add(Lbuttons,BorderLayout.SOUTH);
//adding event Listeners
monInt.addActionListener(this);
monPay.addActionListener(this);
add(mainPanel);
pack();
setVisible(true);
}
private class ActionHandler implements ActionListener{
public void actionPerformed(ActionEvent d){
Object ch= d.getSource();
String amount1=String.valueOf(atxt.getText());
String interest2=String.valueOf(interest.getText());
String months2=String.valueOf(mtxt.getText());
double monthly,i,j;
double payment;
if(ch==monInt){
i=(rate*months);
j=(i*amount);
monthly=(j*1);
JOptionPane.showMessageDialog(null,monthly);
}
else{
payment=(monthly+rate);
if(ch==monPay){
JOptionPane.showMessageDialog(null,payment);
System.exit(0);
}
}
public static void main(String[] args){
LoanInfo loan= new LoanInfo();
loan.launchFrame();
}
}
but there are still a lot of error,,.help me..
i dont know what to do next..