Re: display.set/getComponent()

Hi Mathias,

> If I have different displays which appear at different times at the same
> Panel in my app, what's the better way to to this with regard to
> performance and memory issues:
>
> 1) Panel.add(display[0].getComponent());
>    // Do some stuff
>    Panel.remove(display[0].getComponent());
>    Panel.add(display[1].getComponent());

This is the right way.

> 2) JPanel displayPanel = new JPanel();
>    Panel.add(displayPanel);
>    // Do some stuff
>    display[0].setComponent(displayPanel);
>    // Do some stuff
>    display[1].setComponent(displayPanel);

This is the wrong way.

> What exactly does the setComponent()?

This method probably shouldn't be public. Its just for
subclasses of DisplayImpl (i.e., DisplayImplJ3D and
DisplayImplJ2D) to "register" the Component they create.

Cheers,
Bill


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: