A simple window program.
Introduction
A simple windows program to show usage of window program and Splash window.
1. Edit a java source file: "X:\demos\src\hello\HelloSplashWindow.java"
package hello;
import javax.swing.*;
import java.awt.BorderLayout;
import com.regexlab.j2e.SplashScreen;
public class HelloSplashWindow extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
// splash
private static SplashScreen splash = null;
/**
* @param args
*/
public static void main(String[] args) {
// disable auto close
getSplashWindow().autoClose(-1);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
HelloSplashWindow thisClass = new HelloSplashWindow();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
// close splash window
getSplashWindow().close();
}
});
}
/**
* This is the default constructor
*/
public HelloSplashWindow() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(300, 200);
this.setContentPane(getJContentPane());
this.setTitle("JFrame");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
}
return jContentPane;
}
/**
* Get instance of splash window
*
* @return
*/
private static SplashScreen getSplashWindow()
{
if(splash == null) {
splash = SplashScreen.getSplashScreen();
}
return splash;
}
}
2. Enter "X:\demos" directory and compile it to a class file:
X:\>cd demos X:\demos>javac -cp lib/jar2exe_integrate.jar src/hello/HelloSplashWindow.java
3. Make a jar file:
X:\demos>jar -cvf hellosplash.jar -C src .
4. Use Jar2Exe to generate exe file for Windows only:
X:\demos>j2ewiz hellosplash.jar /m hello.HelloSplashWindow /type windows /splash splash.jpg
The splash window supports Windows only.
5. Download the program for reference.
- hellosplash.zip - 119k, download this demo program.
- demos.7z - 5.75M, all demos in one file.
See Also
- See Splash Window page for more details about Splash Window.
