Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTabbedPane Checks

 
peter hammond
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi guys

i have a jtabbedpane with 4 tabs....

is there a way to check that an item is selected on tab 1 before allowing to select the 2nd tab??

hope that makes sence
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not until you qualify what it means for an item to be 'selected'

edit And the class is JTabbedPane, not jtabbedpane. Java is case sensitive, and it would be nice if you would use the correct case in your postings.
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add a ChangeListener to listen to changes that have already happened, but as far as I know there's no way to block changing the selected tab. You can of course change back to the first tab instead.
 
peter hammond
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok many thanks i couldnt think of a way to test each panel before moving onto the next.

i will try to think of another way to test if all items that are required to be selected are selected............

this is the model..

TAB 1
NAME:
AGE:
D.O.B
TAB 2
ADDRESS:
PHONE NO:
TAB 3
OTHER INFO
TAB 4
Button ADD TO DB.. <------- checks all data and just shows error dialogbox with the items missing...
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Spoor wrote:as far as I know there's no way to block changing the selected tab.

The selection takes place in the JTabbedPane's model. To repeat what I said on another forum in respect of unusual requirements for selection in a JList, weird selection behavior requires an equally weird selection model.

This one's not too weird ;)
 
Rob Spoor
Sheriff
Pie
Posts: 20532
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't even know JTabbedPane used a model as well...
 
peter hammond
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sweet awsome thanks alot

i will try and write this in when i get back home..

 
peter hammond
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
awsome work my friend works great just need to mod it a bit so i get the required results..

thanks alot.... that was a hard one...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic