If you want to place components on top of the view, you must place those components in an overlay panel and place that panel on top of the view.
You can use the javax.swing.JLayeredPane
class from the JDK, and follow the example in the samples.gxy.common.OverlayPanel
class:
import java.awt.Component;
import javax.swing.JLayeredPane;
import com.luciad.gui.swing.TLcdOverlayLayout;
/**
* This panel wraps a view ( or more generally any Component ) and adds support for adding
* components over the view.
*/
public class OverlayPanel extends JLayeredPane {
public OverlayPanel(Component aMap) {
setLayout(new TLcdOverlayLayout());
add(aMap, TLcdOverlayLayout.Location.FULL_EXTENT);
setLayer(aMap, -1);
}
}
The OverlayPanel
can be created with the view component, such as a TLcdMapJPanel
:
OverlayPanel overlayPanel = new OverlayPanel(fMap);
and populated with navigation controls:
protected void addOverlayComponents(OverlayPanel aOverlayPanel) {
Component controls = TLcdGXYNavigationControlsFactory.createNavigationControls(fMap, false);
aOverlayPanel.add(controls, TLcdOverlayLayout.Location.NORTH_EAST);
}