📄 intanimationview.java
字号:
package graphicAnimation.intAnimationView;
import graphicAnimation.*;
import java.awt.*;
/**
* 简单整数视图类,直接以某种颜色在屏幕上显示整数数值
*
*/
public class IntAnimationView extends AnimationView {
protected int value = 0; // 整数数值
public IntAnimationView() { }
public IntAnimationView(int value) { this.value = value; }
public IntAnimationView(int value, Point pos) {
super(pos);
this.value = value;
}
public IntAnimationView(int value, Point pos, Color color) {
super(pos, color);
this.value = value;
}
/**
* 设置该视图所保存的整数数值
*/
public void setValue(int value) { this.value = value; }
/**
* 返回会该视图所保存的整数数值
*/
public int getValue() { return value; }
/**
* 以当前颜色在当前位置显示所保存的整数数值
*/
public void paint(Graphics gc) {
if (!visible) return;
gc.setColor(color);
gc.drawString(value+"", position.x, position.y);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -