随笔 - 119  文章 - 3173  trackbacks - 0
<2007年4月>
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

交友莫独酒,茅台西凤游。
口干古井贡,心徜洋河流。
称多情杜康,趟无量双沟。
赞中华巍巍,无此不销愁。

常用链接

留言簿(68)

随笔分类(136)

随笔档案(122)

最新随笔

搜索

  •  

积分与排名

  • 积分 - 520462
  • 排名 - 93

最新评论

splash,闪屏,说白了了就是启动广告,许多正规软件或者说许多软件为了显示自己正规,在启动的时候都要来这么一下。明明自己程序启动慢,怕用户启动以后半天看不到东西而产生不满、怀疑或鄙视,为了转移矛盾而弄出这么个讨厌的东西。对于splash偶一向除之而后快,比如加-nosplash,直接删掉splash文件等等。
但是今天偶还是要和大家一起来看看java6里面怎么为自己的程序加上splash,鄙视一下自己先。

 1import java.awt.BorderLayout;
 2import javax.swing.JFrame;
 3import javax.swing.JLabel;
 4
 5
 6public 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(100100500375);
28        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
29
30        final JLabel label = new JLabel();
31        label.setBounds(6949275102);
32        label.setText("测试splash");
33        getContentPane().add(label);
34        //
35    }

36
37}

38

准备一个图片,比如Splash.gif
cmd到项目路径下
java -splash:splash.gif HelloSplash

OK,虚拟机启动之后,对话框启动之前就会看到你准备的图片。
posted on 2007-04-15 23:10 交口称赞 阅读(1109) 评论(2)  编辑  收藏 所属分类: Java6

FeedBack:
# re: 学习Java6(八)Splash(1)HellpSplash 2007-04-16 14:03 JAVA-HE
谢谢分享。  回复  更多评论
  
# re: 学习Java6(八)Splash(1)HellpSplash 2007-04-16 16:03 交口称赞
大家互相学习
  回复  更多评论
  

只有注册用户登录后才能发表评论。


网站导航: