panelexample.java

来自「Java程序设计技巧与开发实例附书源代码。」· Java 代码 · 共 25 行

JAVA
25
字号

import java.applet.*;
import java.awt.*;

public class PanelExample
    extends Applet
{
   public void init()
   {
      Panel buttons = new Panel();
      buttons.setLayout(new FlowLayout());
      buttons.add(new Button("Okay"));
      buttons.add(new Button("Cancel"));
      Panel textGrid = new Panel();
      textGrid.setLayout(new GridLayout(2, 2));
      for (int i = 0; i < 4; i++)
      {
         textGrid.add(new TextField(4));
      }
      setLayout(new BorderLayout());
      add("North", buttons);
      add("Center", textGrid);
   }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?