日期:2014-05-20 浏览次数:21085 次
import java.awt.*; import java.io.FileInputStream; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JOptionPane; /** * 启动闪现屏幕 * * @author dll<dll at zzti> */ public class Check_Frm { static String message = "初始化中……"; static int sleeptime = 1000; public Check_Frm() { Splash splash = new Splash(); //这里写初始化的内容 message = "千山鸟飞绝"; splash.drawInfo(message); sleep(); message = "万径人踪灭"; splash.drawInfo(message); sleep(); /** * 此处省略代码为启动主窗体,当启动时闪屏自动消失 */ } void sleep() {//暂停 try { Thread.sleep(sleeptime); } catch (InterruptedException ex) { Logger.getLogger(Check_Frm.class.getName()).log(Level.SEVERE, null, ex); } } public static void main(String[] args) {//主函数 new Check_Frm(); } } class Splash { SplashScreen splash = SplashScreen.getSplashScreen(); final Graphics2D g2 = splash.createGraphics(); final Color color = g2.getBackground(); final Dimension size = splash.getSize(); int i = 0; public void drawInfo(String info) { mess = info; g2.setPaintMode(); g2.setColor(Color.black); g2.setFont(new Font("华文行楷", Font.PLAIN, 15)); g2.drawString(info, 0, 10);//每次都从这个位置(0,10)开始画字符串 splash.update(); } }