framedcounter.java

来自「书籍"Java_面向事件编程"的附带光盘代码」· Java 代码 · 共 24 行

JAVA
24
字号
import objectdraw.*;import java.awt.*;// A FramedCounter object displays a numeric counter on// a background framed by a distinct borderpublic class FramedCounter extends FramedText {        private int counter = 0;          // Current value of counter        // Create a FramedCounter object displaying 0    // at the position and with the dimensions specified    public FramedCounter( double x, double y, double width, double height,                          DrawingCanvas canvas ) {        super( "0", x, y, width, height, canvas );    }        //  Increase the counter's value and update display    public void increment( int amount ) {        counter = counter + amount;        message.setText( counter );        positionContents();    }   }

⌨️ 快捷键说明

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