org.openide.util.Utilities.createProgressCursor()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(69)

本文整理了Java中org.openide.util.Utilities.createProgressCursor()方法的一些代码示例,展示了Utilities.createProgressCursor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utilities.createProgressCursor()方法的具体详情如下:
包路径:org.openide.util.Utilities
类名称:Utilities
方法名:createProgressCursor

Utilities.createProgressCursor介绍

[英]Returns a cursor with an arrow and an hourglass (or stop watch) badge, to be used when a component is busy but the UI is still responding to the user. Similar to the predefined Cursor#WAIT_CURSOR, but has an arrow to indicate a still-responsive UI.

Typically you will set the cursor only temporarily:

// code is running in other then event dispatch thread 
currentComponent.setCursor(Utilities.createProgressCursor(currentComponent)); 
try { 
// perform some work in other than event dispatch thread 
// (do not block UI) 
} finally { 
currentComponent.setCursor(null); 
}

This implementation provides one cursor for all Mac systems, one for all Unix systems (regardless of window manager), and one for all other systems including Windows. Note: The cursor does not have to look native in some cases on some platforms!
[中]返回带有箭头和沙漏(或秒表)标记的光标,当组件正忙但UI仍在响应用户时使用。类似于预定义的游标#WAIT_游标,但有一个箭头指示仍有响应的UI。
通常,您只能暂时设置光标:

// code is running in other then event dispatch thread 
currentComponent.setCursor(Utilities.createProgressCursor(currentComponent)); 
try { 
// perform some work in other than event dispatch thread 
// (do not block UI) 
} finally { 
currentComponent.setCursor(null); 
}

此实现为所有Mac系统提供一个游标,为所有Unix系统(不考虑窗口管理器)提供一个游标,为包括Windows在内的所有其他系统提供一个游标。注意:在某些平台上,光标在某些情况下不必看起来是本地的!

代码示例

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

private void showWaitCursor () {
  if (getRootPane () == null) return ;
  contentPane = getRootPane ().getContentPane ();
  if (SwingUtilities.isEventDispatchThread ()) {
    contentPane.setCursor (Utilities.createProgressCursor (contentPane));
  } else {
    SwingUtilities.invokeLater (new CursorR (contentPane,Utilities.createProgressCursor (contentPane)));
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

private void showWaitCursor () {
  if (getRootPane () == null) return ;
  contentPane = getRootPane ().getContentPane ();
  if (SwingUtilities.isEventDispatchThread ()) {
    contentPane.setCursor (Utilities.createProgressCursor (contentPane));
  } else {
    SwingUtilities.invokeLater (new CursorR (contentPane,Utilities.createProgressCursor (contentPane)));
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-wizards

private void setupCombo() {
  final Cursor currentCursor = getCursor();
  setCursor(Utilities.createProgressCursor(this));
  Utilities.attachInitJob(comMode, new AsyncGUIJob() {
    Set<String> modes;
    @Override
    public void construct() {
      try {
        modes = DesignSupport.existingModes(data);
      } catch (IOException exc) {
        Logger.getLogger(BasicSettingsPanel.class.getName()).log(Level.INFO, null, exc);
      }
    }
    @Override
    public void finished() {
      comMode.setModel(new DefaultComboBoxModel(modes != null ? modes.toArray(new String[modes.size()]) : DEFAULT_MODES));
      setComModeSelectedItem();
      windowPosChanged(null);
      setCursor(currentCursor);
      loadedComboBox = true;
      checkValidity();
    }
  });
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-dataconnectivity

public void modelProjectForDataSources(Project currentProj) {
  project = currentProj;
  ModelSet.addModelSetsListener(modelingListener);
  topComponent = TopComponent.getRegistry().getActivated();
  topComponent.setCursor(Utilities.createProgressCursor(topComponent));
  String progressBarLabel = org.openide.util.NbBundle.getMessage(DataSourceResolver.class, "LBL_ProgressBar"); //NOI18N
  
  try {
    // model project 
    FacesModelSet modelSet = FacesModelSet.startModeling(project);
    if (modelSet == null) {
      handle = ProgressHandleFactory.createHandle(progressBarLabel);
      handle.start();
      handle.switchToIndeterminate();
    }
    // If modeling has been completed then terminate the progress cursor and update the project
    if (modelSet != null) {
      if (handle != null) {
        handle.finish();
      }
      ModelSet.removeModelSetsListener(modelingListener);
      ProjectDataSourceTracker.refreshDataSourceReferences(project);
      update(project);
    }
  } finally {
    topComponent.setCursor(null);
  }
}

相关文章

微信公众号

最新文章

更多