GUI(Graphics User Interface)知识点
JFrame常用方法
- pdf238(书222页)
- 窗口的创建及2种窗口关闭
- 代码:
package javaGui1;
import javax.swing.*;
import java.awt.*;
public class JavaSwing1 {
public static void main(String[] args) {
JFrame windows1 = new JFrame("第一个窗口");
JFrame windows2 = new JFrame("第二个窗口");
Container con = windows1.getContentPane();
con.setBackground(Color.yellow);
windows1.setBounds(60,100,188,108);
windows2.setBounds(260,100,188,108);
windows1.setVisible(true);
windows2.setVisible(true);
windows1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
windows2.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}