scrollingsimple.java

来自「这是java编程中与applet有关的一些小例子」· Java 代码 · 共 46 行

JAVA
46
字号
/* * 1.0 code (remains the same in 1.1). */import java.applet.Applet;import java.awt.TextField;public class ScrollingSimple extends Applet {    TextField field;    public void init() {        //Create the text field and make it uneditable.        field = new TextField();        field.setEditable(false);        //Set the layout manager so that the text field will be        //as wide as possible.        setLayout(new java.awt.GridLayout(1,0));        //Add the text field to the applet.        add(field);        validate();  //this shouldn't be necessary        addItem("initializing... ");    }    public void start() {        addItem("starting... ");    }    public void stop() {        addItem("stopping... ");    }    public void destroy() {        addItem("preparing for unloading...");    }    void addItem(String newWord) {        String t = field.getText();        System.out.println(newWord);        field.setText(t + newWord);    }}

⌨️ 快捷键说明

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