import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JPanel;

public class Card  extends JPanel
{
	private CardValues value;
	private CardSuits suit;
	private BufferedImage image;

	public CardValues getValue() {
		return value;
	}

	public CardSuits getSuit() {
		return suit;
	}

	public Card(CardValues v, CardSuits s) {
		value = v;
		suit = s;

		setPreferredSize(new Dimension(Globals.CARD_WI, Globals.CARD_HI));
		setSize(Globals.CARD_WI, Globals.CARD_HI);
		image = getCardImage();
		setOpaque(false);
	}

	@Override
	public void paintComponent(Graphics g)
	{

		//setVisible(true);
		Graphics2D g2d = (Graphics2D)g;
		super.paintComponent(g2d);

		if(image == null)
		{
			setVisible(false);
		}
		else
		{				
			g2d.drawImage(
					image.getScaledInstance(Globals.CARD_WI, Globals.CARD_HI, Image.SCALE_SMOOTH)
					, 0, 0, this);
			
		}	
	}

	private BufferedImage getCardImage()
	{
		try
		{
			return ImageIO.read(getClass().getResourceAsStream("/images/" + this.toString() + ".png"));
		} catch(IOException e)
		{
			System.err.println(e);
			return null;
		}
	}


	@Override
	public String toString() {
		String string;
		switch (value) {
		/*case BACK:
                string = "card_back";
                break;*/
		case ACE:
			//case ONE:
			string = "Ace" + suit.getValue();
			break;
		case JACK:
			string = "Jack"+ suit.getValue();
			break;
		case QUEEN:
			string = "Queen" + suit.getValue();
			break;
		case KING:
			string = "King" + suit.getValue();
			break;
		case TWO:
			string = "Two" + suit.getValue();
			break;
		case THREE:
			string = "Three" + suit.getValue();
			break;
		case FOUR:
			string = "Four" + suit.getValue();
			break;
		case FIVE:
			string = "Five" + suit.getValue();
			break;
		case SIX:
			string = "Six" + suit.getValue();
			break;
		case SEVEN:
			string = "Seven" + suit.getValue();
			break;
		case EIGHT:
			string = "Eight" + suit.getValue();
			break;
		case NINE:
			string = "Nine" + suit.getValue();
			break;
		case TEN:
			string = "Ten" + suit.getValue();
			break;
		default:
			string = value.getValue() + suit.getValue();
		}
		return string;
	}
}

@@ -352,32 +352,24 @@
 ;%0D%0A%09private 
-Buffered
 Image image;
@@ -675,31 +675,309 @@
 %0D%0A%09%09
-image = getCardImage();
+%0D%0A%09%09// moved getScaled instance from paint component%0D%0A%09%09// this way the program only scales the image down once. %0D%0A%09%09// rather than  every few seconds%0D%0A%09%09image = getCardImage().getScaledInstance(Globals.CARD_WI, Globals.CARD_HI, Image.SCALE_SMOOTH);%0D%0A%09%09%0D%0A%09%09if(image == null)%0D%0A%09%09%09setVisible(false);%0D%0A%09%09
 %0D%0A%09%09
@@ -1156,185 +1156,27 @@
 %0D%0A%09%09
-if(image == null)%0D%0A%09%09%7B%0D%0A%09%09%09setVisible(false);%0D%0A%09%09%7D%0D%0A%09%09else%0D%0A%09%09%7B%09%09%09%09%0D%0A%09%09%09g2d.drawImage(%0D%0A%09%09%09%09%09image.getScaledInstance(Globals.CARD_WI, Globals.CARD_HI, Image.SCALE_SMOOTH)%0D%0A%09%09%09%09%09
+g2d.drawImage(image
 , 0,
@@ -1191,19 +1191,8 @@
 );%0D%0A
-%09%09%09%0D%0A%09%09%7D%09%0D%0A
 %09%7D%0D%0A
@@ -1517,112 +1517,19 @@
 %0D%0A%09%09
-/*case BACK:%0D%0A                string = %22card_back%22;%0D%0A                break;*/%0D%0A%09%09case ACE:%0D%0A%09%09%09//case ON
+%0D%0A%09%09case AC
 E:%0D%0A

Add Card class optimizations