我想在Appliation开始之前将光标更改为沙漏 当您在eclipse中单击“运行”时,它应该显示小时玻璃。我的应用程序需要4秒的时间来加载Swing应用程序,其中大约需要3秒来获取与系统相关的属性。 我尝试使用setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
。但没有太多的改进措施在应用程序启动Java swing之前等待光标
任何人都可以在这方面
这是我的代码
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
---
--
}
您发布的代码不能编译也不能运行,因此不符合[sscce](http://sscce.org)标准,使我们很难提供帮助。考虑创建一个新的程序来显示你的问题,并且不做任何事情 - 它试图创建一个等待光标,它延迟加载几秒钟(一个Thread.sleep(...)将很好地工作),它编译和它运行。 –
可能...,也许使用SplashScreen,更多在Oracle教程 – mKorbel