1 package project; 2 import javax.swing.*; 3 import java.awt.*; 4 public class test 5 { 6 public static void main(String args[]) 7 { 8 JFrame window1 , window2; 9 window1 = new JFrame("第一个");10 window2 = new JFrame("第二个");11 Container con = window1.getContentPane(); //得到当前画板12 con.setBackground(Color.blue); //设置背景颜色13 window1.setBounds(30, 40, 70, 60);14 window2.setBounds(60, 90, 70, 60);15 window1.setVisible(true); //窗口是否可见16 window1.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); //注销释放掉这个窗口17 window2.setVisible(true); 18 window2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);19 20 21 }22 }
JFrame类的一些基本用法.