/*
* Copyright (c) 2007, persianmobidict.sourceforge.net
* Released under the GNU General Public License
*/
package pmd.gui;
import javax.microedition.lcdui.*;
/**
*
* @author Hooman Valibeigi
*/
public class ImageIconWidget extends Widget {
private Image icon;
public ImageIconWidget(Image icon) {
setFocusable(false);
setIcon(icon);
}
public Image getIcon() {
return icon;
}
public void setIcon(Image icon) {
if (icon == null)
throw new IllegalArgumentException("null");
this.icon = icon;
repaint();
}
public void paintWidget(Graphics g) {
g.drawImage(icon, ((getWidth() - icon.getWidth()) >> 1), ((getHeight() - icon.getHeight()) >> 1), 0);
}
}
|