shapeicon.java
来自「用java实现接口,实现不同图形的移动效果,主要是演示接口的用法」· Java 代码 · 共 33 行
JAVA
33 行
import javax.swing.*;
import java.awt.*;
/**
* Created by IntelliJ IDEA.
* User: Administrator
* Date: 2006-11-21
* Time: 20:27:30
* To change this template use File | Settings | File Templates.
*/
public class ShapeIcon implements Icon {
private int width, height;
private MoveableShape shape;
public ShapeIcon(int width, int height, MoveableShape shape) {
this.width = width;
this.height = height;
this.shape = shape;
}
public void paintIcon(Component component, Graphics graphics, int i, int i1) {
shape.draw(graphics);
}
public int getIconWidth() {
return width;
}
public int getIconHeight() {
return height;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?