Article View: borland.public.jbuilder.java.language
Article #18445Re: Removing a JTabbedPane tab and its components
From: Anne Ritchie
Date: Mon, 22 Jun 1998 00:00
Date: Mon, 22 Jun 1998 00:00
46 lines
1621 bytes
1621 bytes
I found a solution to this problem...
int i = jTabbedPane1.getSelectedIndex();
jTabbedPane1.removeTabAt(i);
jTabbedPane1.validate();
repaint();
You have to validate the Tab.
Anne Ritchie wrote in message <6m3er5$3rj4@forums.borland.com>...
>Help....
>
>I'm having a curious problem with the JTabbedPane. After removing a tab
its
>component is sometimes still visible and only gets removed by clicking on a
>different tab and back.
>
>Using the following code I remove the selected tab.
>
> int i = jTabbedPane1.getSelectedIndex();
> jTabbedPane1.removeTabAt(i);
> repaint();
>
>When tabs are removed from right to left there is no problem since the
index
>is decremented and the selected tab's index is different from the removed
>tab's index. When removing a tab from left to right or from the middle,
the
>tab is removed, but its components are still visible, because the newly
>selected tab has the same index as the removed tab...
>
>
>Anybody resolved this one?
>
>TIA
>
>Anne Ritchie
>aritchie@oriental.com
>
>
>
>
>
Technical Details
Message-ID:
<6mm014$h9i11@forums.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<6m3er5$3rj4@forums.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,9b97d672ba7e6d60 X-Google-Attributes: gidf74b3,public From: "Anne Ritchie" <aritchie@oriental.com> Subject: Re: Removing a JTabbedPane tab and its components Date: 1998/06/22 Message-ID: <6mm014$h9i11@forums.borland.com> X-Deja-AN: 365013207 References: <6m3er5$3rj4@forums.borland.com> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Another Netscape Collabra Server User Newsgroups: borland.public.jbuilder.java.language