但是今天偶還是要和大家一起來看看java6里面怎么為自己的程序加上splash,鄙視一下自己先。
?1
import?java.awt.BorderLayout;
?2
import?javax.swing.JFrame;
?3
import?javax.swing.JLabel;
?4
?5
?6
public?class?HelloSplash?extends?JFrame?
{
?7
?8
????/**?*//**
?9
?????*?Launch?the?application
10
?????*?@param?args
11
?????*/
12
????public?static?void?main(String?args[])?
{
13
????????try?
{
14
????????????HelloSplash?frame?=?new?HelloSplash();
15
????????????frame.setVisible(true);
16
????????}?catch?(Exception?e)?
{
17
????????????e.printStackTrace();
18
????????}
19
????}
20
21
????/**?*//**
22
?????*?Create?the?frame
23
?????*/
24
????public?HelloSplash()?
{
25
????????super();
26
????????getContentPane().setLayout(null);
27
????????setBounds(100,?100,?500,?375);
28
????????setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
29
30
????????final?JLabel?label?=?new?JLabel();
31
????????label.setBounds(69,?49,?275,?102);
32
????????label.setText("測試splash");
33
????????getContentPane().add(label);
34
????????//
35
????}
36
37
}
38

?2

?3

?4

?5

?6



?7

?8


?9

10

11

12



13



14

15

16



17

18

19

20

21


22

23

24



25

26

27

28

29

30

31

32

33

34

35

36

37

38

準(zhǔn)備一個(gè)圖片,比如Splash.gif
cmd到項(xiàng)目路徑下
java -splash:splash.gif HelloSplash
OK,虛擬機(jī)啟動之后,對話框啟動之前就會看到你準(zhǔn)備的圖片。