*/
public static ImageIcon createChannelIcon(Icon ic) {
BufferedImage img = new BufferedImage(getChannelIconWidth(), getChannelIconHeight(), BufferedImage.TYPE_INT_RGB);
if (ic == null) {
ic = new ImageIcon("./imgs/tvbrowser16.png");
}
int height = 20;
int width = 40;
if ((ic.getIconWidth() != 0) && (ic.getIconHeight() != 0)) {
double iWidth = ic.getIconWidth();
double iHeight = ic.getIconHeight();
if (iWidth / iHeight < 2.0) {
width = (int) (iWidth * (20.0 / iHeight));
} else {
height = (int) (iHeight * (40.0 / iWidth));
}
}
ic = scaleIcon(ic, width, height);
Graphics2D g = img.createGraphics();
g.setColor(Color.WHITE);
g.fillRect(1, 1, 40, 20);
int x = 1 + 20 - ic.getIconWidth() / 2;
int y = 1 + 10 - ic.getIconHeight() / 2;
ic.paintIcon(null, g, x, y);
g.setColor(Color.BLACK);
g.drawRect(0, 0, 42, 22);
return new ImageIcon(img);
}