📄 iconpainter.java
字号:
package com.croftsoft.core.animation.painter;
import java.awt.Graphics2D;
import javax.swing.Icon;
import javax.swing.JComponent;
import com.croftsoft.core.lang.NullArgumentException;
/*********************************************************************
* Paints an Icon at an (x,y) position.
*
* @version
* 2003-07-11
* @since
* 2002-02-14
* @author
* <a href="http://croftsoft.com/">David Wallace Croft</a>
*********************************************************************/
public class IconPainter
extends AbstractXYPainter
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
{
protected Icon icon;
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
public IconPainter (
int x,
int y,
Icon icon )
//////////////////////////////////////////////////////////////////////
{
super ( x, y );
setIcon ( icon );
}
public IconPainter ( Icon icon )
//////////////////////////////////////////////////////////////////////
{ this ( 0, 0, icon );
}
//////////////////////////////////////////////////////////////////////
// accessor methods
//////////////////////////////////////////////////////////////////////
public Icon getIcon ( ) { return icon; }
//////////////////////////////////////////////////////////////////////
// mutator methods
//////////////////////////////////////////////////////////////////////
public void setIcon ( Icon icon )
//////////////////////////////////////////////////////////////////////
{
NullArgumentException.check ( this.icon = icon );
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
public void paint (
JComponent component,
Graphics2D graphics )
//////////////////////////////////////////////////////////////////////
{
icon.paintIcon ( component, graphics, x, y );
}
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -