SplashScreen
ユーザーがアプリケーションの起動をキャンセルできるように、キャンセル ボタンをオンにすることはできますか?
どのように?
1 に答える
1
スプラッシュ スクリーンは単なるボーダレス ウィンドウです (JFrame を使用して作成できます)。System.exit(0); を呼び出す JButton を持つパネルを追加できます。アプリケーションをロードする代わりに。
JFrame frame = new JFrame("");
JPanel panel = new JPanel();
JButton cancel = new JButton("Cancel Loading");
cancel.addMouseListener(new MouseAdapter(){/*add listener, call System.exit(0);*/});
panel.add(cancel);
JLabel label = new JLabel();
//set image of the label which will be your application's icon
frame.getContentPane().add(panel);
frame.setUndecorated(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(400, 200); //400x200 splash screen
frame.setVisible(true);
于 2012-10-18T22:28:33.097 に答える