Execute instructions before JTabbedPane change of tabulation

Hi,
I use JTabbedPanes,
in one of them the user can do operations that need to be saved (JButton Save).
But if he choose another Tabulation without saving everything is lost.
How can I ask the user to save the operations before the JTabbedPane change of Tabulation ?
Thank you for any help.
LVL 9
matthew016Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
>>everything is lost.

Why so?

You could use a ChangeListener, but at the moment, i don't see why you need to
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
matthew016Author Commented:
That's the way my programs works.
I can't really explain this shortly.
But in my tabulations I have JPanels but they have not the method addChangeListener.
0
matthew016Author Commented:
I see that I can use ComponentListener
componentHidden(ComponentEvent e)
componentShown(ComponentEvent e)
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

matthew016Author Commented:

Ok I have several problems when I use a ComponentListener:

1.The event is called after the tab is changed, so I have my JOptionPane above the new tab clicked.

2.I tought I could ask the user to Save with options Yes, No, Cancel
   And when he clicks cancel the tab shouldn't change, do u think it is possible to do that ?
0
CEHJCommented:
It's difficult to assist you only knowing the vaguest details. Suffice it to say at this stage that it's possible to autosave continuously, which i would imagine would cure the problem
0
CEHJCommented:
:-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.