此代码说明了如何实现它.
注意:setUndecorated(true); 构造函数中的语句.
框架已经显示时,您无法取消框架.
public class MyFrame extends JFrame {
private JPanel contentPane;
private JTextField textField;
/**
* Launch the application.
*/
public static void main(String[] args) {
MyFrame frame = new MyFrame();
frame.setVisible(true);
}
/**
* Create the frame.
*/
public MyFrame() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBackground(Color.ORANGE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
/* important Statement */
setUndecorated(true);
}
Run Code Online (Sandbox Code Playgroud)
}

| 归档时间: |
|
| 查看次数: |
51786 次 |
| 最近记录: |