我有一个带有几个 PanelDescriptor 的向导迭代器。当在一个实现 WizardDescriptor.ValidatingPanel 的 PanelDescriptor 上单击“下一步”时,我试图显示等待光标。其中的 validate() 方法需要时间执行。
到目前为止,我尝试了几种方法,它们都不适合我。
- http://dev.platform.netbeans.narkive.com/ofiffInN/finally-a-waitcursor-routine-that-works-in-netbeans
http://netbeans-org.1045718.n5.nabble.com/Setting-wait-cursor-td3026613.html#a3026614
private static void changeCursorWaitStatus(final boolean isWaiting) { Mutex.EVENT.writeAccess(new Runnable() { public void run() { try { JFrame mainFrame = (JFrame) WindowManager.getDefault().getMainWindow(); Component glassPane = mainFrame.getGlassPane(); if (isWaiting) { glassPane.setVisible(true); glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); } else { glassPane.setVisible(false); glassPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } catch (Exception e) { // probably not worth handling } } }); }
https://community.oracle.com/message/5322657#5322657
try { TopComponent.getRegistry().getActivated().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); doBusyStuff(); } finally { TopComponent.getRegistry().getActivated().setCursor(Cursor.getDefaultCursor()); }
任何能指出我正确方向的提示都将不胜感激。