icancount.java
来自「书籍"Java_面向事件编程"的附带光盘代码」· Java 代码 · 共 23 行
JAVA
23 行
import objectdraw.*;import java.awt.*; // A program to count as high as you can click.public class ICanCount extends WindowController { // Where to display the instructions private static final Location INSTR_POS = new Location( 20, 100); private int theCount = 0; // how high we have counted // Create the Text to display the current count public void begin() { new Text( "Click to make me count", INSTR_POS, canvas ); } // Increase the count with each click public void onMouseClick(Location point) { theCount = theCount + 1; System.out.println( theCount ); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?