card game -part1
 

package cardgame;
import java.awt.*;
import javax.swing.*;

public class card extends JComponent
{
private ImageIcon _img;
private int _x;
private int _y;
public card(ImageIcon img)
{
    _img=img;
}
public void moveTo(int x,int y)
{
_x=x;
_y=y;
}
public int getWidth()
{
    return _img.getIconWidth();
}
public int getHeight()
{
    return _img.getIconHeight();
}
public int getX() 
{
    return _x;
}
public int getY() 
{
    return _y;
}
public void draw(Graphics g, Component c) 
{
    _img.paintIcon(c, g, _x, _y);
}
}

share on whatapp
189 Views

Comments

 
 
Private Policy   Terms of Service   4922