Here you can find the source of createColorIcon(Color color)
Parameter | Description |
---|---|
color | the color |
public static ImageIcon createColorIcon(Color color)
//package com.java2s; //License from project: Open Source License import java.awt.Color; import java.awt.Graphics; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; public class Main { /**//from w ww .j a v a2s .c o m * Creates the color icon. * * @param color the color * @return the image icon */ public static ImageIcon createColorIcon(Color color) { BufferedImage buffImage = new BufferedImage(16, 16, BufferedImage.TYPE_INT_ARGB); Graphics g = buffImage.getGraphics(); g.setColor(color); g.fillRect(0, 0, 16, 16); g.setColor(Color.black); g.drawRect(0, 0, 15, 15); return new ImageIcon(buffImage); } }