总结:
1.Frame是一个顶级窗口
2.Panel无法单独显示,必须添加到某个容器中
3.布局管理器
1.流式
2.东西南北中
3.表格
4.大小、定位、背景颜色、可见性,监听
实现如下图所示
java代码
package com.like.lesson01;
import javax.swing.border.Border;
import java.awt.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
public class TestDemo01True {
public static void main(String[] args) {
Frame frame = new Frame();
frame.setLayout(new GridLayout(2,1));
frame.setSize(400,300);
frame.setLocation(300,400);
frame.setBackground(new Color(212, 241, 153));
frame.setVisible(true);
frame.setLayout(new GridLayout(2,1));
Panel p1 = new Panel(new BorderLayout());
Panel p2 =