Solved

Stop changing tabs in a JTabbedPane

Posted on 2006-06-22
7
714 Views
Last Modified: 2008-01-09
Hi,

I'm using a JTabbedPane and at some point, I need to prevent it from leaving a particular tab (due to a condition), even though the user wants to go to a different  tab . Is this possible with JTabbedPane. I also want to make sure that stateChanged listener doesn't get called.

Thanks
0
Comment
Question by:anthony0007
7 Comments
 
LVL 14

Accepted Solution

by:
hoomanv earned 32 total points
ID: 16961190
you can disable the other tabs so he cant move to them
using JTabbedPane.setEnabledAt(int index, boolean enabled)
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 31 total points
ID: 16961334
Personally i wouldn't do that. Your users will probably just think your ui is broken
0
 

Author Comment

by:anthony0007
ID: 16961626
Isn't there any other way to prevent it from moving to other tabs. stateChanged Listener gets called once the tab has been changed.
If I can capture an event before tab changes, then it might be helpful.
0
 
LVL 15

Assisted Solution

by:Javatm
Javatm earned 31 total points
ID: 16963904
Well I can only see to option :

1. Either disable the item or
2. Blast a JOptionPane if he goes to other tabs while there is unfinish
task this will not allow him to go to the next tab if you trap it with
a dialog to remind him.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 31 total points
ID: 16964567
yyou would disable the other tabs as hoomanv suggested.
then reenable them when they are allowed to change again.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
word0 challenge 3 58
pairs challenge 5 44
for i loop in grovy 1 32
get weblogic logged in user in java 2 42
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now