• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

event action in applet not working

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic