Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   why is remove(myPanel2) not working? (http://www.velocityreviews.com/forums/t145202-why-is-remove-mypanel2-not-working.html)

Geoff Cox 07-29-2005 01:39 PM

why is remove(myPanel2) not working?
 
Hello,

For some reason the

contentArea.remove(myPanel3);

works but the

contentArea.remove(myPanel2);

does not - any ideas please?

(happy to post the whole code if this helps)

Cheers

Geoff


if (textIndex == 0)
{


contentArea.remove(myPanel2);

contentArea.remove(myPanel3);
myPanel3 = new JPanel();
myPanel3.setBackground(Color.white);

JLabel endMessage = new JLabel("Thank you - all questions
answered");

myPanel3.add(endMessage);
contentArea.add(myPanel3, BorderLayout.SOUTH);
setContentPane(contentArea);
contentArea.setVisible(true);

}

Andrew Thompson 07-29-2005 01:56 PM

Re: why is remove(myPanel2) not working?
 
On Fri, 29 Jul 2005 13:39:53 GMT, Geoff Cox wrote:

> For some reason the
>
> contentArea.remove(myPanel3);
>
> works


[1]

>...but the
>
> contentArea.remove(myPanel2);


[1] What do you mean 'it works'? *Specifically* what
do you mean? Describe it in detail, ..
<http://www.physci.org/codes/javafaq.jsp#specific>
...or..

> does not - any ideas please?
>
> (happy to post the whole code if this helps)


...provide that code. Since the word
descriptions are not that clear.

E.G. you state that removing the myPanel3 'works', yet
your code immediately re-adds it, so I am not certain
how *you* can be sure it is *ever* removed in the first
place.

And look, for my personal preferences, the SSCCE[1] provided
with the brief explanation and question is almost always
necessary. *Especially* when the poster[2] has no idea what is
going wrong. The trick is that if the poster does not know
what is going wrong, they often (usually) post the wrong
'bit' of code.

[1] <http://www.physci.org/codes/sscce.jsp>
[2] you, in this instance, but could be anyone.

[ Note: Follow-Ups to this response set to c.l.j.help only. ]

--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Beats A Hard Kick In The Face


All times are GMT. The time now is 04:15 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.