package statusicon;

import java.awt.Graphics2D;
import java.awt.TrayIcon;
import java.awt.image.BufferedImage;

import javax.swing.ImageIcon;

public class StatusIcon {

	private int width;
	private int height;
	private TrayIcon icon;
	private int max;
	private int value;
	
	public StatusIcon(int width, int height, TrayIcon icon) {
		this.width = width;
		this.height = height;
		this.icon = icon;
	}
	
	public StatusIcon(TrayIcon icon) {
		this(16, 16, icon);
	}
	
	public StatusIcon() {
		this(16, 16, null);
	}
	
	public ImageIcon getIcon() {
		return new ImageIcon(update());
	}
	
	public BufferedImage update() {
		BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
		Graphics2D g = image.createGraphics();
		
		return image;
	}
	
	public int getValue() {
		return this.value;
	}
	
	public void setValue(int value) {
		this.value = value;
	}
	
	public int getMaximum() {
		return this.max;
	}
	
	public void setMaximum(int max) {
		this.max = max;
	}
}

@@ -42,16 +42,39 @@
 hics2D;%0A
+import java.awt.Image;%0A
 import j
@@ -127,16 +127,39 @@
 edImage;
+%0Aimport java.util.List;
 %0A%0Aimport
@@ -291,16 +291,22 @@
  int max
+ = 100
 ;%0A%09priva
@@ -319,16 +319,52 @@
  value;%0A
+%09private List%3CImage%3E progressIcons;%0A
 %09%0A%09publi
@@ -404,32 +404,59 @@
 t, TrayIcon icon
+, List%3CImage%3E progressIcons
 ) %7B%0A%09%09this.width
@@ -509,16 +509,153 @@
 = icon;%0A
+%09%09this.progressIcons = progressIcons;%0A%09%7D%0A%09%0A%09public StatusIcon(int width, int height, TrayIcon icon) %7B%0A%09%09this(width, height, icon, null);%0A
 %09%7D%0A%09%0A%09pu
@@ -706,16 +706,22 @@
 16, icon
+, null
 );%0A%09%7D%0A%09%0A
@@ -1003,16 +1003,221 @@
 s();%0A%09%09%0A
+%09%09if (progressIcons == null) %7B%0A%09%09%09%0A%09%09%7D else %7B%0A%09%09%09Image current = progressIcons.get((int) (((float) value / (float) max) * progressIcons.size()));%0A%09%09%09g.drawImage(current, 0, 0, width, height, null);%0A%09%09%7D%0A%09%09%0A
 %09%09return

Default value for max is 100