Solved

set one of my JTabbedPane invisible

Posted on 2004-08-26
21
750 Views
Last Modified: 2008-02-20
Hi,

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



Xenia
0
Comment
Question by:xenia27
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 6
  • 2
  • +3
21 Comments
 
LVL 35

Expert Comment

by:girionis
ID: 11900369
Try calling setVisible(false) on it.
0
 
LVL 92

Assisted Solution

by:objects
objects earned 200 total points
ID: 11900422

or remove it

tabs.remove(tabindex);
0
 
LVL 35

Accepted Solution

by:
TimYates earned 300 total points
ID: 11900424
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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
LVL 35

Expert Comment

by:TimYates
ID: 11900430
hehe
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11900552
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
 

Author Comment

by:xenia27
ID: 11900562
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
 
LVL 35

Expert Comment

by:TimYates
ID: 11900587
I think panel.setVisible( false ) would set the page blank (but the tab would remain) :-(
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11900590
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
 
LVL 12

Expert Comment

by:Giant2
ID: 11900609
>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
 
LVL 92

Expert Comment

by:objects
ID: 11900621
> 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
 
LVL 35

Expert Comment

by:TimYates
ID: 11900633
> 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
 
LVL 12

Expert Comment

by:Giant2
ID: 11900648
>> 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
 
LVL 35

Expert Comment

by:TimYates
ID: 11900677
Giant2, do you mean  

    tabbedPane.setEnabledAt( int, boolean )

?  As "panel.setEnabled( false )" doesn't do anything to the tab pane...
0
 
LVL 35

Expert Comment

by:TimYates
ID: 11900687
> its contents are not visible,

They are if the other tabs are removed (such as in a multi-tabbed text editor)
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11900730
>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
 
LVL 35

Expert Comment

by:TimYates
ID: 11900747
> maybe both will go well (now I try to test them)

I just did...  panel.setEnabled doesn't change the tab...
0
 
LVL 12

Expert Comment

by:Giant2
ID: 11900749
>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
 
LVL 35

Expert Comment

by:girionis
ID: 11901055
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
 
LVL 35

Expert Comment

by:TimYates
ID: 11901061
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
 
LVL 30

Expert Comment

by:Mayank S
ID: 11901066
If you don't have to add the tab again, then I guess removing it would be better rather than calling setVisible ().
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 11901070
>> It seems that the setVisible() does not work with my code too

Oh well ;-) then remove it!
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Suggested Courses

617 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