Results 1 to 2 of 2
Thread: JTabbedPane losing listener
- 02-03-2012, 02:20 AM #1
Member
- Join Date
- Feb 2012
- Posts
- 1
- Rep Power
- 0
JTabbedPane losing listener
I have a JTabbedPane with 3 tabs and at the end a 'plus' tab (which is used to add in other tabs to the JTabbedPane). When I mouse click the 'plus' tab it adds in a fifth tab at index 3 (i.e. just before the + tab) and brings up a JOptionPane so that I can give a title to the new tab (at index 3). However, if I cancel the JOptionPane before inputting a title, the code
should remove the newly inserted tab at index 3 and leave the JTabbedPane in its original state.Java Code:JTabbedPane jtp = getITDAJTabbedPane(); jtp.remove(index);
What is actually happening is that the tab at index 3 is indeed being removed but the 'plus' tab no longer responds to mouse clicks to add in a new tab - it is as though the 'plus' tab has lost its ChangeListener.
Anyone know how to fix this one?
-
Re: JTabbedPane losing listener
I'm not sure how we can guess what's wrong or how to fix it without a functioning code example, but we don't want to see you're entire program either as that would over load the volunteers here with too much code, most of it unrelated to the problem at hand. I suggest that you create and post a new program, a minimal compilable and runnable example with the intent that it just demonstrate the problem and nothing else, an SSCCE.
Similar Threads
-
Action-Listener with multiple Arguments? (Button Listener, specifically)
By Kevinw778 in forum AWT / SwingReplies: 2Last Post: 12-11-2011, 10:44 PM -
Swing Applet losing dirty data
By ptreves in forum Java AppletsReplies: 1Last Post: 09-25-2011, 03:30 PM -
NetBeans losing package information when crashing
By Kethas in forum New To JavaReplies: 4Last Post: 03-03-2010, 05:38 AM -
Losing Packets/Bytes using DataInputStream and socket
By ajordanneve in forum NetworkingReplies: 0Last Post: 03-24-2009, 05:22 AM -
Problems with JFrame losing the Design view
By chris@gaiag.net in forum NetBeansReplies: 7Last Post: 07-23-2008, 07:35 AM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks