?1
import
?javax.swing.
*
;
?2
import
?java.awt.
*
;
?3
?4
public
?
class
?DelaySplash?
{
?5
????
public
?
static
?
void
?main(String?args[])?
{
?6
????????Runnable?runner?
=
?
new
?Runnable()?
{
?7
????????????
public
?
void
?run()?
{
?8
????????????????
try
?
{
?9
????????????????????Thread.sleep(
5000
);
10
????????????????}
?
catch
?(InterruptedException?e)?
{
11
????????????????}
12
????????????????JFrame?frame?
=
?
new
?JFrame(
"
Splash
"
);
13
????????????????frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
14
????????????????JLabel?label?
=
?
new
?JLabel(
"
延遲?Splash?5s
"
,?JLabel.CENTER);
15
????????????????frame.add(label,?BorderLayout.CENTER);
16
????????????????frame.setSize(
300
,?
95
);
17
????????????????frame.setVisible(
true
);
18
????????????}
19
????????}
;
20
????????EventQueue.invokeLater(runner);
21
????}
22
}
23

?2

?3

?4



?5



?6



?7



?8



?9

10



11

12

13

14

15

16

17

18

19

20

21

22

23

運行方式和學習Java6(八)Splash(1)HellpSplash一樣