📄 mainframe.java~5~
字号:
package jspleshwindowdemo;import java.awt.*;import java.awt.event.*;import javax.swing.*;/** * <p>Title: </p> * <p>Description: </p> * <p>Copyright: Copyright (c) 2002</p> * <p>Company: </p> * @author unascribed * @version 1.0 */public class MainFrame extends JFrame implements Runnable { private JPanel contentPane; private BorderLayout borderLayout1 = new BorderLayout(); private SpleshWindow spleshWindow=null; //Construct the frame public MainFrame() { enableEvents(AWTEvent.WINDOW_EVENT_MASK); try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } //Component initialization private void jbInit() throws Exception { //setIconImage(Toolkit.getDefaultToolkit().createImage(MainFrame.class.getResource("[Your Icon]"))); contentPane = (JPanel) this.getContentPane(); contentPane.setLayout(borderLayout1); this.setSize(new Dimension(400, 300)); this.setTitle("JSpleshWindowDemo"); Thread t = new Thread(this); t.start(); // wait splash window visible try{ t.join(); }catch ( InterruptedException e ){ e.printStackTrace() ; } // ----- Beging do your things ----- long x=System.currentTimeMillis(); while ( System.currentTimeMillis()-x <15000 ) { System.out.print( "Waiting "+(15000-System.currentTimeMillis()+x+" \r") ); // you can set status string in splash window spleshWindow.setStatus( "Waiting "+(15-(long)(System.currentTimeMillis()/1000)+(long)(x/1000)) ); } // ----- after you done -----// // close logo window if ( spleshWindow!=null ) { spleshWindow.dispose(); spleshWindow=null; } } //Overridden so we can exit when window is closed protected void processWindowEvent(WindowEvent e) { super.processWindowEvent(e); if (e.getID() == WindowEvent.WINDOW_CLOSING) { System.exit(0); } } public void run() { /**@todo Implement this java.lang.Runnable method*/ // new & show dialog spleshWindow=new SpleshWindow( this ); spleshWindow.show();// throw new java.lang.UnsupportedOperationException("Method run() not yet implemented."); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -