Java----定义一个窗口
package stu1; import javax.swing.*; import java.awt.*; public class window { public static void main(String[] args){ //定义一个窗口对象windows1 JFrame windows1 = new JFrame("windows1"); JFrame windows2 = new JFrame("windows2"); Container container1 = windows1.getContentPane(); //设置窗体背景颜色 container1.setBackground(Color.darkGray); //设置窗体的显示坐标及窗体大小 windows1.setBounds(60,100,500,500); windows2.setBounds(300,100,500,500); //设置窗口是否可以调整大小 windows1.setResizable(true); windows2.setResizable(false); //设置窗口是否可见 windows1.setVisible(true); windows2.setVisible(true); //隐藏当前窗口 windows2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //结束应用进程 windows1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }