gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15945
  • QQ554730525
  • 铜币25337枚
  • 威望15352点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
阅读:2202回复:0

a Wait-Cursor

楼主#
更多 发布于:2003-07-29 22:07
HowTo:  Display a Wait-Cursor while the data is being fetched and displayed on

Summary
Instructions provided describe how to display a custom Wait-Cursor, such as hour-glass, while data are being accessed and displayed in a Map component.


Procedure
Create a custom DisplayListener and override the start and finish methods. The start method should include a call to aMap.setWaiting(true) when a display event starts, such as redraw, change the Map extent, and set a layer's visibility. The finish method should include a call to aMap.setWaiting(false) when the display event finishes.


Instantiate a DisplayListener object and override its start and finish methods as follows:


public class CursorTest extends JFrame{
  
  private     com.esri.mo.ui.bean.Map       map1;
  private     com.esri.mo.ui.bean.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);

       }  
       };
...


  Do not create the DisplayListener object as a local variable or with a weak reference; otherwise, listener instances may be garbage-collected immediately.

Set a custom Wait-Cursor for the Map.

map1.setWaitingCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));


 Call this method only if displaying a custom cursor. WAIT_CURSOR (hour-glass) will be selected by default.

Add the DisplayListener object to the Map.

map1.addDisplayListener(dl);  
喜欢0 评分0
游客

返回顶部