aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTabbedPane Checks Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTabbedPane Checks" Watch "JTabbedPane Checks" New topic
Author

JTabbedPane Checks

peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
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

Joined: May 03, 2008
Posts: 4658
    
    5

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.

luck, db
There are no new questions, but there may be new answers.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
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

Joined: May 03, 2008
Posts: 4658
    
    5

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

Joined: Oct 27, 2005
Posts: 19761
    
  20

I didn't even know JTabbedPane used a model as well...
peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
sweet awsome thanks alot

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

peter hammond
Ranch Hand

Joined: Apr 20, 2011
Posts: 41
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...
 
 
subject: JTabbedPane Checks