/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package javaapplication1; import java.awt.*; import java.awt.geom.AffineTransform; import javax.swing.*; import com.samodelkin.*; /** * * @author Сергей */ public class MyCanvas extends JPanel implements Runnable{ private BaseSprite s; private Image i; public MyCanvas(){ this.setSize(600,600); i=new ImageIcon("images/image.png").getImage(); s=new BaseSprite(i); s.setPosition(100, 100); new Thread(this).start(); } public void paint(Graphics g){ s.paint(g); } public void run(){ while(true){ this.repaint(); try{Thread.sleep(50);}catch(Exception e){} } } }