Solved

Stop changing tabs in a JTabbedPane

Posted on 2006-06-22
7
716 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
java 8 lambda expresssions exception handling 3 91
how do i compare an object based on two fields 6 54
diffSum example 4 37
jdbc error in jsp application 20 46
This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

810 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