This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
JRummikub/src/jrummikub/view/impl/ImageUtil.java
Matthias Schiffer 45d5b3ae10 Implement pause function
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@390 72836036-5685-4462-b002-a69064685172
2011-06-08 21:58:16 +02:00

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);
}
}