Java JComponent Color makeEmptyIcon(Dimension size, Color color)

Here you can find the source of makeEmptyIcon(Dimension size, Color color)

Description

make Empty Icon

License

Open Source License

Declaration

public static ImageIcon makeEmptyIcon(Dimension size, Color color) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.Color;

import java.awt.Dimension;

import java.awt.Graphics;

import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;

public class Main {
    public static ImageIcon makeEmptyIcon(Dimension size, Color color) {
        ImageIcon result = null;/* w  w w .jav a  2s.  c  o m*/

        BufferedImage bufferedImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_ARGB);
        Graphics graphics = bufferedImage.getGraphics();
        graphics.setColor(color);
        graphics.fillRect(0, 0, size.width, size.height);
        result = new ImageIcon(bufferedImage);

        return result;
    }
}

Related

  1. findPanel(JColorChooser chooser, String name)
  2. fixOsxColorChooser(JColorChooser chooser)
  3. flashMessage(final Window parent, String string, Color background, Color foreground, final long howLong)
  4. highlightForDebugging(JComponent component, Color color)
  5. installColors(Component c, Color background, Color foreground)
  6. newColorComponent(Color value)
  7. normalize(float q, float p, float color)
  8. recursiveSetBackground(Component comp, Color color)