wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JButton on multiple instances of applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JButton on multiple instances of applet" Watch "JButton on multiple instances of applet" New topic
Author

JButton on multiple instances of applet

Alfred Harre
Ranch Hand

Joined: Apr 29, 2004
Posts: 73
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

Joined: Jan 14, 2004
Posts: 1535
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
 
subject: JButton on multiple instances of applet
 
Similar Threads
Multiple Instances of an applet
closing !!
Show images on the screen without using JFrame
JFrame in applet
JApplet or JFrame ?