Article View: borland.public.jbuilder.java.swing
Article #8353Re: Corrupted JTabbedPane display
From: Arie van Wingerden
Date: Mon, 25 Sep 2000 00:00
Date: Mon, 25 Sep 2000 00:00
69 lines
2917 bytes
2917 bytes
Hello,
since I got no response to my problem, I leaked some litres of sweat and
found a way to circumvent the problem.
What I do now is:
- by default the radiobuttons are made invisible
- when the TAB contaning the radiobuttons is pressed (MousePressed event
upon JTabbedPanel - using the getSelectedIndex) method) I make the
radiobuttons visible and execute the Validate method for my instance of
CheckBocPanel
- when any other TAB is clicked I make the radiobuttons invisible
Since I am a newbie on Java, I do not know whether this is common practice,
or is it a workaround for a bug. Perhaps anybody out there can tell me this?
Thanks,
Arie
Arie van Wingerden <awing@hetnet.nl> schreef in berichtnieuws
OHzxGlWJAHA.254@net025s...
> Hello gurus,
>
> I've got a problem and hope ther is somebody out there who can help me.
>
> I've got a JTabbedPane (named jTabbedPane1) with 4 TABs. Every TAB
> contains a Jpanel.
> In the last JPanel I defined (using GridLayout 1,3 ) 2 other JPanels and a
> CheckBoxPanel (see my class definition below).
>
> If I run my applet and SelectedIndex() has been set to a TAB different
from
> the one containing my CheckBoxPanel class,
> my Radiobuttons (instantiated in my class) "overlay" the JPanel display of
a
> different TAB.
> If I click on other TABs, the same problem occurs. However, the problem
> disappears as soon as I have clicked once one the TAB containing my
> CheckBoxPanel class. Clicking other TABs afterwards results in correct
> displays.
>
> If I set the SelectedIndex() in the applet's Init(0 code right away to the
> TAB containing class CheckBoxPanel, Then the problem doesn't show up.
> However, I need to open the applet with another TAB!!
>
> class CheckBoxPanel extends JPanel {
> CheckboxGroup CGroup;
> Checkbox[] check;
> CheckBoxPanel(Vector name) {
> CGroup = new CheckboxGroup();
> check = new Checkbox[name.size()];
> setBackground(Color.white);
> setForeground(Color.black);
> for (int i=0; i < name.size(); i++) {
> check[i] = new Checkbox((String)name.get(i), CGroup, false);
> check[i].setFont(new java.awt.Font("Monospaced", 0, 12));
> check[i].setBackground(Color.white);
> check[i].setForeground(Color.black);
> add(check[i]);
> }
> check[0].setState(true);
> }
> }
>
> Thanks in advance,
> Arie.
>
>
>
>
Technical Details
Message-ID:
<#SoUisuJAHA.225@net025s>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<OHzxGlWJAHA.254@net025s>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,66c81aad297eb472 X-Google-Attributes: gid111d45,public From: "Arie van Wingerden" <awing@hetnet.nl> Subject: Re: Corrupted JTabbedPane display Date: 2000/09/25 Message-ID: <#SoUisuJAHA.225@net025s> X-Deja-AN: 673846392 References: <OHzxGlWJAHA.254@net025s> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing