sampleframe.java

来自「是一个加快Java应用程序国际化和本地化开发的工具集。它将大大减少国际化和本地化」· Java 代码 · 共 31 行

JAVA
31
字号
import java.awt.*;import java.awt.event.*;public class SampleFrame extends Frame {    public static void main(String[] args) {        Frame f = new Frame("This is a testing template!");        Font font = new Font("Times", Font.PLAIN, 18);        f.setFont(font);                System.out.println("Current font: " + f.getFont());        MenuBar bar = new MenuBar();        Menu fileMenu = new Menu("file");        MenuItem openItem = new MenuItem("open ...");        fileMenu.add(openItem);        bar.add(fileMenu);        f.setMenuBar(bar);                f.setLayout(new BorderLayout());        Label label = new Label("hello world!");        f.add("North", label);        f.add("West", new Button("begin"));        f.add("Center", new Button("end"));        f.setSize(200, 200)                f.setVisible(true);        f.addWindowListener(new WindowAdapter() {            public void windowClosing(WindowEvent e) {                System.exit(0);            }        });    }}

⌨️ 快捷键说明

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