欢迎屏幕 如何制作一闪而过的欢迎屏幕,比如说ms office进入时的图片 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 为 Java 桌面应用程序添加 Splash 屏幕 http://tech.sina.com.cn/s/2006-04-19/1457909992.shtml使用jdk/jre 6以上的版本,挺方便的. 看来要研究一下jdk1.6的了.以前一直用低版本的. 我N年前的源码(去掉了一些):import javax.swing.*;import java.awt.*;import java.awt.event.*;public class App { JFrame frame; JWindow splash; public App(GraphicsConfiguration gc) { frame = new JFrame("app", gc); createSplash(); SwingUtilities.invokeLater(new Runnable() { public void run() { showSplash(); splash.repaint(); } }); initFrame(); SwingUtilities.invokeLater(new Runnable() { public void run() { showFrame(); hideSplash(); } }); } private void createSplash() { splash = new JWindow(frame); splash.getContentPane().add(new JLabel(new ImageIcon("images/splash.jpg"))); splash.pack(); Rectangle rec = frame.getGraphicsConfiguration().getBounds(); splash.setLocation(rec.x + rec.width/2 - splash.getSize().width/2, rec.y + rec.height/2 - splash.getSize().height/2); } private void showSplash() { splash.show(); } private void hideSplash() { splash.setVisible(false); splash = null; } private void initFrame() { // some code here } private void showFrame() { frame.pack(); frame.setVisible(true); frame.repaint(); } public static void main(String[] args) { new App(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration()); }} 关于手机向电脑发短信 高手进啊······ Row update failed. 大家来挑错 JNI如何传递vc中带指针的参数和函数的问题 编译apple小程序的问题? JTable怎么自动随窗口改变大小 菜鸟想飞,请各位大虾赐教! 快速拿分! 如何让一个int转变成String? toString()为什么不行? 老生常谈的关于List的效率问题 求一道java题的答案,尽量详细点 java如何判断apache的日志文件正在被使用?50分
使用jdk/jre 6以上的版本,挺方便的.
import java.awt.*;
import java.awt.event.*;public class App {
JFrame frame;
JWindow splash;
public App(GraphicsConfiguration gc) {
frame = new JFrame("app", gc);
createSplash();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
showSplash();
splash.repaint();
}
});
initFrame();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
showFrame();
hideSplash();
}
});
}
private void createSplash() {
splash = new JWindow(frame);
splash.getContentPane().add(new JLabel(new ImageIcon("images/splash.jpg")));
splash.pack();
Rectangle rec = frame.getGraphicsConfiguration().getBounds();
splash.setLocation(rec.x + rec.width/2 - splash.getSize().width/2,
rec.y + rec.height/2 - splash.getSize().height/2);
}
private void showSplash() {
splash.show();
}
private void hideSplash() {
splash.setVisible(false);
splash = null;
}
private void initFrame() {
// some code here
} private void showFrame() {
frame.pack();
frame.setVisible(true);
frame.repaint();
}
public static void main(String[] args) {
new App(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration());
}
}