package main.java.gui.components;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.image.BufferedImage;

import main.java.gui.util.Resources;

@SuppressWarnings("serial")
public class AvatarPanel extends Panel{

	Color avatarColor;
	BufferedImage bufferedImage;
	
	public AvatarPanel(Color avatarColor) {
		super();
		this.avatarColor = avatarColor;
		chooseAvatar();
	}
	
	public void chooseAvatar() {
		if (avatarColor.equals(Color.RED)) {
			bufferedImage = Resources.imageNamed("avatar_red");
		} else if (avatarColor.equals(Color.YELLOW)) {
			bufferedImage = Resources.imageNamed("avatar_yellow");
		} else if (avatarColor.equals(Color.GREEN)) {
			bufferedImage = Resources.imageNamed("avatar_green");
		} else if (avatarColor.equals(Color.BLUE)) {
			bufferedImage = Resources.imageNamed("avatar_blue");
		} else if (avatarColor.equals(Color.WHITE)) {
			bufferedImage = Resources.imageNamed("avatar_white");
		} else if (avatarColor.equals(Color.BLACK)) {
			bufferedImage = Resources.imageNamed("avatar_black");
		} else {
			bufferedImage = Resources.imageNamed("avatar_not_found");;
		}		
	}
	
	protected void paintComponent(Graphics g) {
		super.paintComponent(g);
		if (bufferedImage != null) {
			g.drawImage(bufferedImage, 0, 0, this.getWidth(), this.getHeight(), null);
		}
		
	}
	
	
}

@@ -240,16 +240,23 @@
 tarColor
+ = null
 ;%0A%09Buffe
@@ -281,16 +281,56 @@
 mage;%0A%09%0A
+%09public AvatarPanel() %7B%0A%09%09super();%0A%09%7D%0A%09%0A
 %09public 
@@ -360,29 +360,28 @@
 rColor) %7B%0A%09%09
-super
+this
 ();%0A%09%09this.a
@@ -1162,16 +1162,193 @@
 %09%09%0A%09%7D%0A%09%0A
+%09public Color getColor() %7B%0A%09%09return this.avatarColor;%0A%09%7D%0A%09%0A%09public void setColor(Color avatarColor) %7B%0A%09%09this.avatarColor = avatarColor;%0A%09%09chooseAvatar();%0A%09%09this.repaint();%0A%09%7D%0A%09%0A
 %09protect

Fix player panel avatar panel