我想在应用程序开始之前将光标更改为沙漏当您单击 Eclipse 中的“运行”时,它应该显示沙漏。我的应用程序需要大约 4 秒来加载 Swing 应用程序,其中大约需要 3 秒来获取系统相关属性。我尝试使用 .setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
但没有太多改进
任何人都可以在这方面提供帮助
这是我的代码
public static void main(String args[]){
String os = System.getProperty("os.name").trim().toLowerCase();
if (!os.equals("windows server 2008 r2") &&
!os.equals("windows server 2012")) {
JOptionPane.showMessageDialog(null, TPDI18N.formatWithBundle(
SsUtils.SS, "ss.error.notSupportedPlatform", os),
TPDI18N.getString("common.error"), JOptionPane.ERROR_MESSAGE);
System.exit(0);
}
System.setProperty("sun.awt.exception.handler",
"somepackage");
ThreadGroup threadGroup = new ThreadGroup("My title") {
@Override
public void uncaughtException(Thread t, Throwable e) {
if (!(e instanceof ThreadDeath)) {
ErrorUtil.logErrorAndExit(e);
}
}
};
Runnable r = new Runnable() {
public void run() {
startApplication();
}
};
new Thread(threadGroup, r).start();
}
private static void startApplication() {
DirUtil.setAppDir(AppLICATION);
MyManager.startGUI(new String[0], LOG4J_SS_CONFIG);//Maximum time is consumed at this place
DirUtil.setHelpTopicDirectory(IMC_HELP_DIR);
WindowsConfigurator.makeInstance(TPDDirUtil.makeLogDir());
MyClassManager main = new MyClassManager();
main.setSize(new Dimension(1000, 720));
centerWindow(main);
main.setVisible(true);
main.setMinimumSize(main.getSize());
}
public MyClassManager() {
super(TPDI18N.getString(Utils.AA, "aa.title"));
//here creation of panel takes place
---
--
}