<CODE>
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class Bank extends Applet
implements ActionListener
{
private Button savingsButton, checkingButton;
private TextField amountTF;
private int amount;
private int check;
private int save;
private Account checking, saving;

public void init()
{
Label inputLbl;
inputLbl = new Label("Enter an amount to deposit or withdraw:");
add(inputLbl);

amountTF = new TextField(10);
add(amountTF);
amountTF.addActionListener(this);

savingsButton = new Button("Savings");
add(savingsButton);
savingsButton.addActionListener(this);

checkingButton = new Button("Checking");
add(checkingButton);
checkingButton.addActionListener(this);

checking = new Account();
saving = new Account();

}

public void actionPerformed (ActionEvent event)
{

if(event.getSource() == savingsButton)
{
amount = Integer.parseInt(amountTF.getText());

if(amount > 0)
{
saving.depositMoney(amount);
save = saving.getBalance();
}
else
if(amount < 0)

{
saving.withdrawMoney(amount);
save = saving.getBalance();
}
}

if(event.getSource() == checkingButton)
{
amount = Integer.parseInt(amountTF.getText());

if(amount > 0)
{
checking.depositMoney(amount);
check = checking.getBalance();
}


else
if(amount < 0)
{
checking.withdrawMoney(amount);
check = checking.getBalance();
}

}

repaint();
}

public void paint(Graphics g)
{
g.drawString("Your Checking Account Balance = $" + check, 70, 90);
g.drawString("Your Saving Account Balance = $" + save, 70, 110);
if(check < 0)
g.drawString("Warning!!! Negative Checking Balance", 70, 130);
if(save < 0)
g.drawString("Warning!!! Negative Saving Balance", 70, 150);

}
}


class Account
{
private int balance;


public Account()
{

}

public void depositMoney(int amount)
{
balance = balance + amount;

}
public void withdrawMoney(int amount)
{
balance = balance + amount;

}
public int getBalance()
{
return balance;

}
public void display()
{


}


}

</CODE>

I wrote the above program for simulating a bank account which works fine but the rule is that i should use display method for displaying the output and should put the code inside this method instead of where i have put it in paint and call the method inside paint(). I am not sure how to do that. Can anyone help me..
kanakatam