import javax.swing.*; import java.awt.event.*; import java.awt.*;public class Test extends JWindow { public static void main(String s[]) { Test n = new Test(); JButton exit = new JButton("Exit"); n.setBounds(100,100,400,400);
n.getContentPane().add(new JLabel("This is test"), BorderLayout.NORTH); n.getContentPane().add(exit, BorderLayout.SOUTH);
exit.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { System.exit(0); } });
http://www.csdn.net/expert/topic/1092/1092395.xml?temp=.4466822
import java.awt.event.*;
import java.awt.*;public class Test extends JWindow
{
public static void main(String s[])
{
Test n = new Test();
JButton exit = new JButton("Exit");
n.setBounds(100,100,400,400);
n.getContentPane().add(new JLabel("This is test"), BorderLayout.NORTH);
n.getContentPane().add(exit, BorderLayout.SOUTH);
exit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
});
n.show();
}
}
这个可以在jframe里去掉标题栏,要在jdk1.4以后才可以
放弃把,这不是Java的强项,事实上,
这是Java的弱项