My program works but.....  please help

heres my problem. my applet asks a math question ( what is x * y ) and user inputs answer in jtext field. when answer is correct, status bar displays " very good!"
if incorrect, status bar displays " sorry, try again". it does this fine, however when the user answer correctly a new problem should be painted on the applet. thats where my problem is, i cant get it to refresh the question.
here is a summary of my code.
public void init()
container....
Jtextfield....
public void paint( Graphics g)
paints the question here
public void actionPerformed(ActionEvent actionEvent)
if / elsestatements checking if answer is correct
public int calculation()
math.random() class method
i know i need to put a while loop in there but i dont know where and i dont know how to call the method that needs to be called. any guidance is greatly appreciated.
thanks

add stuff like this. Everything that is bolded add. NOTE, I am assuming calculate is your button.
boolean flag = false;
public void init()
container....
Jtextfield....
public void paint( Graphics g)
paints the question here
public void actionPerformed(ActionEvent actionEvent)
if(actionEvent.getSource() == calculate){
flag = true;
     if / elsestatements checking if answer is correct
     if(flag){
repaint();
flag = false;
public int calculation()
math.random() class method
}If this works could I have some Duke Dollars?

Similar Messages

Maybe you are looking for

  • TS1292 My card is unreadable and it doesn't start with any of the numbers or letters above? I need to purchase a book for school. Please help me.

    I have for the past three and a half hours have been trying to redeem my itunes gift card. It is for $25.00 and I need to purchase a book. My card is unreadable....The first letters and numbers are fine but the middle....looks like four numbers/lette

  • How do I connect speakers to ipod

    Recently purchased Harmon Kardon Soundsticks I second hand, and an ipod dock. Both have a USB port how do I connect the two together? I am female and not very good with electrical goods!!!!   Windows XP  

  • Why is a special character  inserted into my drafts?

    After I save a draft, and then return later to finish it.... I frequently (more times than not) find that Thunderbird has inserted a ton of  characters in the email, all over. Usually at the end of every sentence. Often the are 3 in a row, with spac

  • Changing logical system name on ECC

    Hi, We have made copy of production to our test environment.  Next, we created a number of copies of the test environment.  We now want to hook the copies up to BI, XI etc. where we don't have multiple test environments, which means that a single BI

  • DC voltage for RTX DUALphone 4088

    Hi,   I'm looking at the Dual phone 4088 for use in my motorhome. My wireless broadband modem runs on a 12V DC adaptor at home, but I run it directly on 12V when on the road. Q:  What is the DC voltage required by the base station for the Dualphone 4