* in an applet environment and will use a JInternalFrame over a JFrame if
* necessary.
*/
public void showPalette() {
WindowSupport ws = getWindowSupport();
if (ws == null) {
ws = createWindowSupport();
paletteListener = new ComponentAdapter() {
public void componentShown(ComponentEvent e) {
firePaletteEvent(e);
}
public void componentHidden(ComponentEvent e) {
firePaletteEvent(e);
}
};
setWindowSupport(ws);
} else {
ws.setTitle(getName());
ws.setContent(getGUI());
}
if (ws != null) {
MapHandler mh = (MapHandler) getBeanContext();
Frame frame = null;
if (mh != null) {
frame = (Frame) mh.get(java.awt.Frame.class);
if (frame == null) {
MapBean mapBean = (MapBean) mh.get("com.bbn.openmap.MapBean");
if (mapBean == null) {
Debug.message("layer",
"Layer.showPalette: Warning...mapBean = null");
} else {
try {
java.awt.Component parent = mapBean.getParent();
while (parent.getParent() != null
&& !(parent instanceof java.awt.Frame)) {
parent = parent.getParent();
}
if (parent instanceof java.awt.Frame) {
frame = (java.awt.Frame) parent;
}
} catch (Exception e) {
e.printStackTrace();
} // ignore any problems here
}
}
}
if (paletteListener != null) {
ws.addComponentListener(paletteListener);
}
ws.displayInWindow(frame);
}
}