我创建了一个Jfram
可是我想执行JFram之前
执行个图片
然后点击图片进入JFRAM框架
不要告诉我在jram前加个Jpane哈,然后用他覆盖JFRAM哈~~我要的不是这个效果
我是想把标题拦和周围的框框的去掉~~
独立的一个张图片
请个位高手指点
小菜菜鸟在这里谢过各位了~
可是我想执行JFram之前
执行个图片
然后点击图片进入JFRAM框架
不要告诉我在jram前加个Jpane哈,然后用他覆盖JFRAM哈~~我要的不是这个效果
我是想把标题拦和周围的框框的去掉~~
独立的一个张图片
请个位高手指点
小菜菜鸟在这里谢过各位了~
import javax.swing.*;
import java.awt.*;public class JWindowDemo extends JWindow{
public static final String SPLASH_ICON = "logo.gif";
private static JWindowDemo s_startWindow = null;
private JLabel m_iconLabel = null; public JWindowDemo() {
super();
initialize();
}
public static JWindowDemo getSingleton() {
if (s_startWindow == null) {
s_startWindow = new JWindowDemo();
}
return s_startWindow;
} public void initialize() {
m_iconLabel = new JLabel();
ImageIcon pic = loadImage(SPLASH_ICON);
m_iconLabel.setIcon(pic);
m_iconLabel.setBorder(null);
this.add(m_iconLabel, BorderLayout.CENTER);
pack();
try{
Toolkit tool= Toolkit.getDefaultToolkit();
setLocation((int)tool.getScreenSize().getWidth()/2-this.getWidth()/2,
(int)tool.getScreenSize().getHeight()/2-this.getHeight()/2);
}catch(Exception ex){}
} private ImageIcon loadImage(String path) {
try {
java.net.URL url = ClassLoader.getSystemClassLoader().getResource(path);
Image image = Toolkit.getDefaultToolkit().getImage(url);
return new ImageIcon(image);
}catch(Exception ex){}
return null;
}
public static void main(String[] args){
JWindowDemo splash = JWindowDemo.getSingleton();
if (splash != null) {
splash.setVisible(true);
}
}
}
去掉window的装饰(如边框、关闭窗口的小部件、标题等等)