summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/view/impl/ImageUtil.java
blob: 02543439b6d5b35e88fa2a75207fecc3591c0cc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
	}
}