git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@390 72836036-5685-4462-b002-a69064685172
40 lines
939 B
Java
40 lines
939 B
Java
package jrummikub.view.impl;
|
|
|
|
import java.awt.Color;
|
|
import java.awt.Graphics2D;
|
|
import java.awt.image.BufferedImage;
|
|
|
|
import javax.swing.ImageIcon;
|
|
|
|
class ImageUtil {
|
|
private ImageUtil() {
|
|
}
|
|
|
|
static ImageIcon createColorIcon(Color c, int size, int border) {
|
|
BufferedImage image = new BufferedImage(size, size,
|
|
BufferedImage.TYPE_INT_RGB);
|
|
Graphics2D g = image.createGraphics();
|
|
|
|
g.setColor(Color.BLACK);
|
|
g.fillRect(0, 0, size, size);
|
|
|
|
g.setColor(c);
|
|
g.fillRect(border, border, size - 2 * border, size - 2 * border);
|
|
|
|
return new ImageIcon(image);
|
|
}
|
|
|
|
static ImageIcon createPauseIcon(int size) {
|
|
BufferedImage image = new BufferedImage(size, size,
|
|
BufferedImage.TYPE_INT_ARGB);
|
|
|
|
Graphics2D g = image.createGraphics();
|
|
|
|
g.setColor(Color.BLACK);
|
|
int barWidth = (int) (size * 0.425f);
|
|
g.fillRect(0, 0, barWidth, size);
|
|
g.fillRect(size - barWidth, 0, barWidth, size);
|
|
|
|
return new ImageIcon(image);
|
|
}
|
|
}
|