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 JTabbedPane Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTabbedPane Problem" Watch "JTabbedPane Problem" New topic
Author

JTabbedPane Problem

Mahesh Kedari
Ranch Hand

Joined: Nov 28, 2009
Posts: 111
Hi all,
Im designing a desktop application. Im using JTabbedPane for forms.
I wanted to show a popup message to user when he leaves current tab unsaved.
Im able to monitor tab switching even using ChangeListener(), but im unable to handle the event when user clicks on any other JXTaskPane shortcut or Menu Item.
Can anyone please suggest me?


Regards,
Mahesh Kedari - Fidus Technologies Ltd.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10519
    
    9

What happens if the user clicks on some menu? Does it change the UI which effectively means the user leaves the tabbed pane in an unsaved state of data??


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Mahesh Kedari
Ranch Hand

Joined: Nov 28, 2009
Posts: 111
Yes Maneesh,
In my application, i have multiple forms, such as Vendor details, customer details, product details etc.
If I am on Vendor details form, creating new vendor, for example, Then without saving this form,I am selecting some other form, lets say customer details.
for loading new form, I am removing current JTabbedPane from current panel and creating new instance of JTabbedPane.

I want to check this event and display a pop up before loading new screen/form.
Also if saving fails due to some reason, user should stay on same screen/form.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10519
    
    9

Well you can have some boolean which indicates the unsaved data state. In all your actions which change the UI, like menus and shortcuts etc you can check this boolean and process accordingly.
There might be something else on the lines of component will become invisible but I am too rushed to hunt for it right now.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTabbedPane Problem