This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JButton on multiple instances of applet

 
Alfred Harre
Ranch Hand
Posts: 73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I have an applet that uses JFrame and JFrame has JButton on it.
when I start multiple instances of this Frame, JButtons work only on the last frame/window and become inactive on any precding window.
Any ideas and help is greatly appreciated.
Regards
 
Craig Wood
Ranch Hand
Posts: 1535
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It sounds like you're trying to reuse an instance variable in class scope, like this:

Here each listener is registered on only one (the last) button.
Try it with button as a local variable, ie, make a separate JButton for each call from launch. Then each button has its own listener. Like this:
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic