import java.awt.*; public class PanelTest { public static void main(String[] args) { var f = new Frame("测试窗口"); var p = new Panel(); p.add(new TextField(10)); p.add(new Button("click")); f.add(p); f.setBounds(30,30,300,500); f.setVisible(true); }}
result: Pannel can not exist alone, it must be placed in other containers.