Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I freeze on one pane of a JTabbedPane?

Tags:

java

swing

Under certain circumstances, I need a JTabbedPane to remain on one pane until the user supplies certain information. Essentially, when this circumstance occurs, I need the current pane to become modal.

How can I implement this? I was thinking I could catch whatever event is triggered when the pane changes, and reset back to the pane I want to stick on. But I'm worried that this won't be quite right, that depending on when the event actually fires the transition to the new pane will happen after I call the method to set the pane to the pane I want, or some other similar race condition. Is there a better way? Is there a way I can make this approach work?

like image 833
skiphoppy Avatar asked Jan 19 '10 19:01

skiphoppy


1 Answers

I would suggest setting the other tabs to disabled. This has a positive effect of providing the user feedback that they cannot click out of the tab. Otherwise they may be madly clicking and wondering why it will not let them leave the tab.

Simply set them enabled again after the required fields are completed.

like image 132
Chris Kannon Avatar answered Sep 22 '22 19:09

Chris Kannon