JSplashWindow,软件启动界面的编写

JSplashWindow,软件启动界面的编写

ID:44811692

大小:73.51 KB

页数:3页

时间:2019-10-29

JSplashWindow,软件启动界面的编写_第1页
JSplashWindow,软件启动界面的编写_第2页
JSplashWindow,软件启动界面的编写_第3页
资源描述:

《JSplashWindow,软件启动界面的编写》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、JSplashWindow,软件启动界面的编写运行如下:(鼠标放置此处会显示等待状态)15秒后如下:代码如下:packagejsplashWindow;importjava.awt.BorderLayout;importjava.awt.Cursor;importjava.awt.Dimension;importjava.awt.Toolkit;importjava.net.URL;importjavax.swing.ImageIcon;importjavax.swing.JFrame;importjavax.s

2、wing.JLabel;importjavax.swing.JPanel;importjavax.swing.JWindow;publicclassJSplashWindowextendsJWindowimplementsRunnable{privatestaticfinallongserialVersionUID=1L;ThreadsplashThread=null;publicJSplashWindow(){setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CU

3、RSOR));JPanelsplash=newJPanel(newBorderLayout());URLurl=getClass().getResource("图片.jpg");if(url!=null){System.out.println("------");splash.add(newJLabel(newImageIcon(url)),BorderLayout.CENTER);}setContentPane(splash);Dimensionscreen=getToolkit().getScreenSize

4、();pack();setLocation((screen.width-getSize().width)/2,(screen.height-getSize().height)/2);}publicvoidrun(){try{setVisible(true);Thread.sleep(15000);}catch(Exceptionex){ex.printStackTrace();}this.dispose();}publicvoidstart(){this.toFront();splashThread=newThr

5、ead(this);splashThread.start();}staticvoidshowFrame(Stringtitle){JFrameframe=newJFrame(title);frame.setSize(400,300);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);DimensionscreenSize=Toolkit.getDefaultToolkit().getScreenSize();DimensionframeSize=frame.

6、getSize();if(frameSize.height>screenSize.height){frameSize.height=screenSize.height;}if(frameSize.width>screenSize.width){frameSize.width=screenSize.width;}frame.setLocation((screenSize.width-frameSize.width)/2,(screenSize.height-frameSize.height)/2);frame.se

7、tVisible(true);}publicstaticvoidmain(String[]args){showFrame("Demosplashwindow");JSplashWindowsplash=newJSplashWindow();splash.start();}}

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。