Tristan, possibly u should just call invalidate() or/and validate()
methods before setting the pane to visible. I think the problem is that
JPanel should calculate the space needed for newly added component in
order to lay it our correctly.
Possibly this would help,
vladimir
Tristan Wang wrote:
>
> I wanted to remove a component that was added to a JPanel and add a new
> component instead. During the execution, the old component was removed,
> but the new one wasn't shown. Can anyone pinpoint out where the problem
> is? Here's part of the code...
>
> //stepPane is a JPanel
> //picture is a JLabel, which was added to stepPane at //the init();
> //newPane is a JPanel
> public void go2Step1() {
> stepPane.remove(picture);
>
> stepPane.add(newPane, BorderLayout.CENTER);
>
> stepPane.setVisible(true);
> stepPane.repaint();
>
> }
>
> __________________________________________________
> Do You Yahoo!?
> Bid and sell for free at http://auctions.yahoo.com
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".