Events are nice, but Swing leaves a lot to be desired when it comes to vetoable events. Not a problem however if you understand basic MVC architecture and observe that a JTabbedPane is actually just a UI view with a SingleSelectionModel underneath. You can subclass SingleSelectionModel and override setSelectedIndex, wherein you can determine whether you want to select the tab or not.
It's not really a repaint issue. Anyway, for these kinds of questions you are probably better of using Sun's more of less official forums, the one for AWT & Swing in particular: http://forums.java.net/jive/forum.jspa?forumID=74 /Casper On Oct 5, 5:58 pm, rich shar <[EMAIL PROTECTED]> wrote: > I've been listening to the java posse for the last two years, but this > is my first post, so please inform me if i break any protocols. > > i'm trying to understand the best way to manage some effects in a > tabbed UI. > > I have 3 JPanels that i added to a JTabbedPane. > When i move from one tab to the other i need to ensure that user saved > their changes and if not inform them with a dialog. > > I used the AncestorListener#ancestorRemoved call to determine when the > user moved to another tab. > And in my implementation i create a dialog. > > But when the dialog comes up the user sees the JPanel that they are > going to, not the JPanel that they came from. I tried to step through > it and it looks like the dialog dispatches all the events before > showing. > > two questions: > 1. Is there a better listener to use? > 2. How can i keep the current panel visible until after the user > confirms using the dialog. > > any help greatly appreciated :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "The Java Posse" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/javaposse?hl=en -~----------~----~----~----~------~----~------~--~---
