display.set/getComponent()

Hi all,

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

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

What exactly does the setComponent()?

Thanks in advance, Mathias


------------------------------------------------------------
Mathias Stümpert
email: mathias@xxxxxxxxxxxx
homepage: www.stuempert.de