Java Application Startup Screen Production

zhaozj2021-02-16  68

Java Application Startup Screen Production 2003-10-10 Views: 198

phenomenon:

When JBuilder starts, there is a startup screen. After all of the JBuilder's initialization work, the startup screen disappears, and the JBuilder can start using it.

solution:

The program is based on a project I have done.

1, create a new start screen Window class

Java.awt.window windowsplash;

2, call the preheadSplash () function, initialize the startup interface

private void prepareSplash () {Toolkit toolkit = Toolkit.getDefaultToolkit (); windowSplash = new Window (this); Image image = toolkit.getImage ( "images" File.separator "splash.gif"); ImageCanvas canvas = new ImageCanvas (image); windowSplash.add (canvas, "Center"); Dimension scmSize = toolkit.getScreenSize (); int imgWidth = image.getWidth (this); int imgHeight = image.getHeight (this); windowSplash.setLocation (scmSize. Width / 2 - (Imgwidth / 2), SCMSIZE.HEIGHT / 2 - (IMGHEIGHT / 2)); Windowsplash.setsize (IMGWIDTH, IMGHET);}

3, call startsplash (), display start interface, display the start interface, then initialize the various visual components of JFrame, initialize the background database, etc. (such as database connections)

Private void startsplash () {Windowsplash.setVisible (TRUE); Windowsplash.tofront ();

4. After all initialization work is completed, call the stopSplash () function, stop the display start screen

Private void stopsplash () {windowsplash.dispose ();} "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "" "

phenomenon:

When JBuilder starts, there is a startup screen. After all of the JBuilder's initialization work, the startup screen disappears, and the JBuilder can start using it. solution:

The program is based on a project I have done.

1, create a new start screen Window class

Java.awt.window windowsplash;

2, call the preheadSplash () function, initialize the startup interface

private void prepareSplash () {Toolkit toolkit = Toolkit.getDefaultToolkit (); windowSplash = new Window (this); Image image = toolkit.getImage ( "images" File.separator "splash.gif"); ImageCanvas canvas = new ImageCanvas (image); windowSplash.add (canvas, "Center"); Dimension scmSize = toolkit.getScreenSize (); int imgWidth = image.getWidth (this); int imgHeight = image.getHeight (this); windowSplash.setLocation (scmSize. Width / 2 - (Imgwidth / 2), SCMSIZE.HEIGHT / 2 - (IMGHEIGHT / 2)); Windowsplash.setsize (IMGWIDTH, IMGHET);}

3, call startsplash (), display start interface, display the start interface, then initialize the various visual components of JFrame, initialize the background database, etc. (such as database connections)

Private void startsplash () {Windowsplash.setVisible (TRUE); Windowsplash.tofront ();

4. After all initialization work is completed, call the stopSplash () function, stop the display start screen

Private void stopsplash () {windowsplash.dispose ();

转载请注明原文地址:https://www.9cbs.com/read-17318.html

New Post(0)