HOW TO
Instructions provided describe how to display a custom Wait-Cursor, such as hour-glass, while data is being accessed and displayed in a Map component.
Code:
public class CursorTest extends JFrame{
private Map map1;
private Layer layer1;
private JPanel contentPane;
JSplitPane jSplitPane1 = new JSplitPane();
BorderLayout borderLayout1 = new BorderLayout();
ZoomPanToolBar zoomPanToolBar1 = new ZoomPanToolBar();
Toc toc1 = new Toc();
DisplayListener dl;
public CursorTest() {
dl = new DisplayAdapter(){
public void start(DisplayEvent e) {
map1.setWaiting(true);
}
public void finish(DisplayEvent e) {
map1.setWaiting(false);
}
};
...
Note:
Do not create the DisplayListener object as a local variable or with a weak reference; otherwise, listener instances may be garbage-collected immediately.
Code:
map1.setWaitingCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
Note:
Call this method only if displaying a custom cursor. WAIT_CURSOR (hour-glass) will be selected by default.
Code:
map1.addDisplayListener(dl);
Get help from ArcGIS experts
Download the Esri Support App