Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JTabbedPane Problem

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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??
 
Mahesh Kedari
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Bartender
Posts: 11445
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic