1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
public class Mainframe extends JFrame implements KeyListener
{
int x = 350;
int y = 250;
Rectangle j = new Rectangle(x, y, 61, 61);
Rectangle adv = new Rectangle (80, 80, 61, 61);
File imagefile = new File("D://RugbySimuler/img/P38.png");
BufferedImage image = null;
/*/.../*/
public void paint(Graphics graphics)
{
try{
graphics.drawImage(ImageIO.read(imagefile),j.x,j.y,j.width,j.height, null);
}
catch(Exception e){}
graphics.fillRect(j.x, j.y, j.width, j.height);
graphics.setColor(Color.RED);
graphics.fillRect(adv.x,adv.y,adv.width,adv.height);
}
/*/.../*/
} |
Partager