0
splash_window
とsplash_window
と表示されています。スプラッシュ画面と私のアプリが最初に表示されます。最初は0%
にあるprogress bar
を持っています。ユーザーに表示されるとすぐに、それを5%
に変更して他のコマンドを実行したいと考えています。
私はアプリのアプリを実行すると私splash screen
が見えるようになり、私は私の他のコマンドが実行されているコンソールで見ることができます前に、the progress bar
の進捗状況は、すでに5%
でです。
splash screen
が画面に表示されるとすぐにコマンドが実行されるようにするにはどうすればいいですか?JFrameが画面上に表示されているときにのみコードを実行します。
マイコード:
//making the splash_window visible after adding all components to it
splash_window.setVisible(true);
//Used to detect when the splash_window is visible to the user
if (splash_window.isShowing()){
//Used to know if the splash_window is visible
System.out.print("Splash screen is complete and now visible." + System.lineSeparator());
//Method used to increase my progress by 5%
initProgress.setValue(getProgress(5));
//Other commands...
}
1)のスプラッシュ画面は、[ 'SplashScreen'(http://docs.oracle.com/javase/8/docs/api/java/awt/SplashScreen見。 html)2)すぐに役立つように、[MCVE]または[短く、自己完結型の正しい例](http://www.sscce.org/)を投稿してください。 –
OSのオーバーヘッドのためにウィンドウが実際に画面に表示される前にWindowListenerに通知されるため、WindowListenerとTimerの組み合わせを使用します – MadProgrammer