📄 splash.java
字号:
package net.aetherial.gis.surface;
/*
* @(#)MyAppSplash.java 1.2 2003-06-01
*
* Copyright (c) 1999-2003 Werner Randelshofer
* Staldenmattweg 2, Immensee, CH-6405, Switzerland
* All rights reserved.
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software is hereby granted without fee,
* provided this copyright notice is retained on all copies.
*/
import java.awt.Frame;
import java.awt.Toolkit;
import java.net.URL;
import java.io.*;
/**
* Demonstrates how to displays a splash window during startup of an application.
* Adapt this class to your liking but keep it small.
*
* @author Werner Randelshofer, Staldenmattweg 2, Immensee, CH-6405, Switzerland.
* @version 1.2 2003-06-01 Revised.
*/
public class Splash extends Object {
private static Frame splashFrame = new Frame();
public static void splash(Frame splashFrame){
URL imageURL = Splash.class.getResource("splash.gif");
if (imageURL != null) {
SplashWindow.splash(splashFrame,
Toolkit.getDefaultToolkit().createImage(imageURL)
);
} else {
System.err.println("Splash image not found");
}
}
public static void splash(){
splash(splashFrame);
}
public static void main(String[] args) {
// NOTE: The splash window should appear as early as possible.
// The code provided here uses Reflection to avoid time
// consuming class loading before the splash window is
// constructed.
// Read the image data and open the splash screen
// ----------------------------------------------
// TO DO: Replace 'splash.gif' with the file name of your splash image.
//Frame splashFrame = null;
Splash.splash(splashFrame);
// NOTE: If you run this application using java -verbose
// you should not see any of your application classes
// being loaded by the JVM until this point (except
// for this class and the SplashWindow class).
//System.out.println("Splash screen displayed");
// Call the main method of the application using Reflection.
// ---------------------------------------------------------
// TO DO: Replace 'MyApp' with the fully qualified class
// name of your application.
try {
Class.forName("net.aetherial.gis.surface.FrameMain")
.getMethod("main", new Class[] {String[].class})
.invoke(null, new Object[] {args});
} catch (Throwable e) {
e.printStackTrace();
System.err.flush();
System.exit(10);
}
// Dispose the splash window by disposing its parent frame
// -------------------------------------------------------
if (splashFrame != null) splashFrame.dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -