📄 shapeicon.java
字号:
package com.bemjh.Shape;
import java.awt.Component;
import java.awt.Graphics;
import javax.swing.Icon;
/**
* <p>Title: MultiMoveableShape</p>
*
* <p>Description: MultiMoveable Shape</p>
*
* <p>Copyright: Copyright (c) 2006</p>
*
* <p>Company: bemjh</p>
*
* @author bemjh
* @version 1.0
*/
public class ShapeIcon implements Icon {
private IMoveable moveShape;
private int width,height;
public ShapeIcon() {
}
/**
* construction of ShapeIcon
* @param moveShape
* @param width
* @param height
*/
public ShapeIcon(IMoveable moveShape, int width, int height) {
this.moveShape = moveShape;
this.width = width;
this.height = height;
}
/**
* Returns the icon's height.
*
* @return an int specifying the fixed height of the icon.
* @todo Implement this javax.swing.Icon method
*/
public int getIconHeight() {
return height;
}
/**
* Returns the icon's width.
*
* @return an int specifying the fixed width of the icon.
* @todo Implement this javax.swing.Icon method
*/
public int getIconWidth() {
return width;
}
/**
* Draw the icon at the specified location.
*
* @param c Component
* @param g Graphics
* @param x int
* @param y int
* @todo Implement this javax.swing.Icon method
*/
public void paintIcon(Component c, Graphics g, int x, int y) {
moveShape.draw(g);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -