why is remove(myPanel2) not working?

Discussion in 'Java' started by Geoff Cox, Jul 29, 2005.

  1. Geoff Cox

    Geoff Cox Guest

    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);

    }
     
    Geoff Cox, Jul 29, 2005
    #1
    1. Advertising

  2. 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
     
    Andrew Thompson, Jul 29, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon-Pierre  Jarry
    Replies:
    2
    Views:
    2,387
    Henrik
    Aug 10, 2005
  2. tshad
    Replies:
    6
    Views:
    21,496
    tshad
    Aug 8, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    922
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,077
    Smokey Grindel
    Dec 2, 2006
  5. Skybuck Flying
    Replies:
    16
    Views:
    689
    tragomaskhalos
    Aug 25, 2007
Loading...

Share This Page