当前位置: 技术问答>java相关
急问:如何去掉窗口的标题条
来源: 互联网 发布时间:2015-01-18
本文导语: 偶用JAVA写程序,希望加一个封面,但做好了图,却发现窗口上方 的蓝色标题条去不掉,请问有办法去掉吗?谢谢! | 给你一个例子 import java.awt.*; import java.awt.event.*; import javax.swing.*; ...
偶用JAVA写程序,希望加一个封面,但做好了图,却发现窗口上方
的蓝色标题条去不掉,请问有办法去掉吗?谢谢!
的蓝色标题条去不掉,请问有办法去掉吗?谢谢!
|
给你一个例子
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class splash extends JFrame
{
Toolkit kit = Toolkit.getDefaultToolkit();
JWindow jw = new JWindow();
JLabel la = new JLabel(new ImageIcon("a.jpg"));
public splash()
{
la.setBorder(BorderFactory.createRaisedBevelBorder());
jw.getContentPane().add(la,BorderLayout.CENTER);
centerWindow();
jw.show();
jw.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
jw.dispose();
System.exit(0);
}
});
}
private void centerWindow()
{
Dimension sc = kit.getScreenSize();
Dimension ls = la.getPreferredSize();
int law = ls.width;
int lah = ls.height;
jw.setLocation(sc.width/2 - (law/2),sc.height/2 - (lah/2));
jw.pack();
}
public static void main(String args[])
{
JFrame fr = new splash();
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class splash extends JFrame
{
Toolkit kit = Toolkit.getDefaultToolkit();
JWindow jw = new JWindow();
JLabel la = new JLabel(new ImageIcon("a.jpg"));
public splash()
{
la.setBorder(BorderFactory.createRaisedBevelBorder());
jw.getContentPane().add(la,BorderLayout.CENTER);
centerWindow();
jw.show();
jw.addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e)
{
jw.dispose();
System.exit(0);
}
});
}
private void centerWindow()
{
Dimension sc = kit.getScreenSize();
Dimension ls = la.getPreferredSize();
int law = ls.width;
int lah = ls.height;
jw.setLocation(sc.width/2 - (law/2),sc.height/2 - (lah/2));
jw.pack();
}
public static void main(String args[])
{
JFrame fr = new splash();
}
}