![]() |
| ||
| Recognizing when a button is pressed. I really appreciate all the help i've been getting on my project lately from you guys, and hopefully this will be the last problem. I've written an applet, and it uses ActionListener to detect when the button is pressed. The program is supposed to go through my methods when the button is pressed. However when i launch the applet and put values in the boxes, nothing happens when i click. Using an embedded class is too hard for me (i've been doing java for 5 weeks, and the only prior experience i had was html). Also i can't seem to make two seperate files, because only one can implement ActionListener. here's what i have so far. making the button - enter = new JButton("Click here to calculate numeric palindrome.");running my methods when i click the button - public void actionPerformed(ActionEvent e) |
| ||
| Re: Recognizing when a button is pressed. Hi everyone, I have no idea the number of JButtons in your application but where's the source?? Try this public void actionPerformed(ActionEvent e) I hope this helps you Yours Sincerely Richard West |
| ||
| Re: Recognizing when a button is pressed. Thanks for responding. I took that code and adapted it to my code, and it compiles, but i still have the same problem. Here is all of the relevant code. Oh and there is only one button. public void init() |
| ||
| Re: Recognizing when a button is pressed. Debugging 101: Put some system.out.println()'s throughout the actionPerformed() method, and all methods it calls. check to make sure all variables have the proper values, and that it even enters certain methods. By the way, what are you doing with these lines: Numtemp = displayN.getText(); Base = displayB.getText(); If those are used in the coorisponding methods called, I would suggest passing them as parameters instead. |
| All times are GMT -4. The time now is 1:25 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC