File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Swing ChangeEvent occur twice Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Swing ChangeEvent occur twice " Watch "Swing ChangeEvent occur twice " New topic
Author

Swing ChangeEvent occur twice

albert kao
Ranch Hand

Joined: Feb 04, 2010
Posts: 245
The existing source codes, which I try to debug, create the MyTabbedPane class from JTabbedPane.
Clicking the tab will generate the ChangeEvent twice inside the addChangeListener.
Why? Is that to make the ChangeEvent occur once only?


2011-10-11 09:02:00,211 DEBUG Langclient.modules.findPanel - addChangeListener index 1
2011-10-11 09:02:00,211 DEBUG Langclient.modules.findPanel - tabsCurrentIndex 1
2011-10-11 09:02:00,211 DEBUG Langclient.modules.findPanel - addChangeListener index 1
2011-10-11 09:02:00,227 DEBUG Langclient.modules.findPanel - tabsCurrentIndex 1
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19651
    
  18

Are you sure that you haven't added your change listeners twice? I created a little SSCCE and I only get one event.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
jQuery in Action, 2nd edition
 
subject: Swing ChangeEvent occur twice
 
Similar Threads
Do something when object changes
FocusListener problem
Servlet Cannot find Find Properties File
Action for JMenuItem