Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

event action in applet not working

 
Jorge Vazquez
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone!...
I got this applet, that converts from decimal to binary to hex and vice versa, but the even listeners are not doing anything... when I enter a number and press enter. nothing happens. Also, the applet crashes when trying to close it. Any help appreciated

 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Jorge, and welcome to the Ranch! Which listener did you expect to respond to the <Enter> key?

Also, the applet crashes when trying to close it.

An Applet is meant to be displayed in a browser. What exactly do you mean by 'closing' an Applet?
 
Jorge Vazquez
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:Hello Jorge, and welcome to the Ranch! Which listener did you expect to respond to the <Enter> key?

this method:


An Applet is meant to be displayed in a browser. What exactly do you mean by 'closing' an Applet?

yeah, but I can also run it in netbeans...
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So now, the first thing you should do is put a System.out.println("in actionPerformed") at the top of the actionPerformed(...) method to confirm that the method is entered. Do that and report the result here.
 
Jorge Vazquez
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl Burke wrote:So now, the first thing you should do is put a System.out.println("in actionPerformed") at the top of the actionPerformed(...) method to confirm that the method is entered. Do that and report the result here.

yeah, I found the problems... one: I declare three variables outside of the class (After I changed my code I forgot to remove them). Second: on line 90 instead of using decNumber I'm using decimalNumber, so I corrected that and seem to work now. Thanks.
 
Darryl Burke
Bartender
Posts: 5148
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm happy you solved your problem yourself, fut I'm flummoxed how you could do this, as Java doesn't allow anything of the sort:
Jorge Vazquez wrote:I declare three variables outside of the class.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic