NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
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
visad
archives: