Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 783
  • Last Modified:

set one of my JTabbedPane invisible

Hi,

How can I set one of my JTabbedPane invisible???  Can I do this??



Xenia
0
xenia27
Asked:
xenia27
  • 8
  • 6
  • 2
  • +3
2 Solutions
 
girionisCommented:
Try calling setVisible(false) on it.
0
 
objectsCommented:

or remove it

tabs.remove(tabindex);
0
 
TimYatesCommented:
Or if you mean set one of the tabs on a tabbedpane invisible, then you will have to call removeTabAt( int ), and add it back in when you wnt to make it visible...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
TimYatesCommented:
hehe
0
 
Giant2Commented:
Or if you mean one of the tab not selectable, then you use setEnabled(false) over the panel non enabled, and setEnabled(true) when you want to make it selectable.
0
 
xenia27Author Commented:
OK...I just wanna set my panel invisible or remove it...I use "removeTabAt" and it works, but not sure why setVisible didn't work?  Any idea?
0
 
TimYatesCommented:
I think panel.setVisible( false ) would set the page blank (but the tab would remain) :-(
0
 
Giant2Commented:
For a TabbedPane I believe is more correct to use the setEnabled (like I told before) and not setVisible.
pan1
pan2
pan3
pan4
tabpan (with pan1, pan2,pan3,pan4)
doing pan3.setEnabled(false) the pan3 is not enabled, so its contents are not visible
0
 
Giant2Commented:
>I use "removeTabAt"

keep attention, because when you want your removed panel be visible, you must recreate (if you don't saved it before in some other variable).
With setEnabled, you do not this. You must only setEnabled(true) and all the previous button, fields, label... present in the pan3 will be visible.
0
 
objectsCommented:
> but not sure why setVisible didn't work?  Any idea?

it makes the entire tabbed pane invisible ie. all the tabs

> doing pan3.setEnabled(false) the pan3 is not enabled, so its contents are not visible

i think it is still visible
0
 
TimYatesCommented:
> keep attention, because when you want your removed panel be visible, you must recreate

Which is what I implied

> doing pan3.setEnabled(false) the pan3 is not enabled, so its contents are not visible

They are still visible, just not selectable...
0
 
Giant2Commented:
>> doing pan3.setEnabled(false) the pan3 is not enabled, so its contents are not visible
>i think it is still visible

its contents are not visible, and on the TabPanel the "tab" relative to it is not selectable (normally with a light gray color).
0
 
TimYatesCommented:
Giant2, do you mean  

    tabbedPane.setEnabledAt( int, boolean )

?  As "panel.setEnabled( false )" doesn't do anything to the tab pane...
0
 
TimYatesCommented:
> its contents are not visible,

They are if the other tabs are removed (such as in a multi-tabbed text editor)
0
 
Giant2Commented:
>tabbedPane.setEnabledAt( int, boolean )
>panel.setEnabled( false )
maybe both will go well (now I try to test them)

>They are if the other tabs are removed (such as in a multi-tabbed text editor)
Sincerely I was even not in this condiction (remove all but leave only the one no enabled) but I think the contents in this case is visible but not enabled.
0
 
TimYatesCommented:
> maybe both will go well (now I try to test them)

I just did...  panel.setEnabled doesn't change the tab...
0
 
Giant2Commented:
>maybe both will go well (now I try to test them)
I just try now both and go. I don't know why, but they go.
0
 
girionisCommented:
It seems that the setVisible() does not work with my code too. Giant2 is it possible to post some sample code of how you are doing it?
0
 
TimYatesCommented:
I still say the only way to be sure, is to remove the tab, and add it back in again when you want it back...
0
 
Mayank SAssociate Director - Product EngineeringCommented:
If you don't have to add the tab again, then I guess removing it would be better rather than calling setVisible ().
0
 
Mayank SAssociate Director - Product EngineeringCommented:
>> It seems that the setVisible() does not work with my code too

Oh well ;-) then remove it!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 8
  • 6
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now