Tabbed panel and action listeners

I am new to Java and developing an application for myself. It contains a tabbed pane with several tabs. Some of the tabs allow data changes that need to be written to files. I am stuck on how to determine if a user leaves one tab for another so I can check for unsaved data and request the user to either save or discard the changes. I can do this with buttons, but if the dumb user (read me) dosen't use the button I can't figure out how to determine if the user changes tabs so I can check for unsaved data changes in the tab they are exiting. TIA

[558 byte] By [Calgariana] at [2007-10-2 0:44:34]
# 1

You have to add a ChangeListener with you JTabbedPane....

eg:

JTabbedPane myTabbedPane = new JTabbedPane();

myTabbedPane.addChangeListener(myChangeListener);

-

FeedFeeds: Read news and blogs the easy way!

http://www.feedfeeds.com

jessua at 2007-7-15 16:59:29 > top of Java-index,Java Essentials,New To Java...
# 2
Thank you. I was unsure what action to listen for and what to associate it with. This helps a lot.
Calgariana at 2007-7-15 16:59:29 > top of Java-index,Java Essentials,New To Java...