Here you can find the source of createColorImageIcon(int w, int h, int c)
Parameter | Description |
---|---|
w | the width |
h | the height |
c | the fill color |
public static ImageIcon createColorImageIcon(int w, int h, int c)
//package com.java2s; /*/*from ww w .jav a 2 s.c om*/ * Copyright 2008-2014, David Karnok * The file is part of the Open Imperium Galactica project. * * The code should be distributed under the LGPL license. * See http://www.gnu.org/licenses/lgpl.html for details. */ import java.awt.image.BufferedImage; import javax.swing.ImageIcon; public class Main { /** * Create a colored image icon. * @param w the width * @param h the height * @param c the fill color * @return the image icon */ public static ImageIcon createColorImageIcon(int w, int h, int c) { BufferedImage img = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { img.setRGB(j, i, c); } } return new ImageIcon(img); } }