| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 
 |  
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
 
import javax.imageio.ImageIO;
import javax.swing.JPanel;
 
 
public class RunTest extends JPanel implements Runnable{
 
	private LeverView levier;
	private Image image;
 
	public RunTest(LeverView levier){
		this.levier=levier;
		try
        {
            this.image = ImageIO.read(new File("ecran.png"));
        }
        catch (IOException e)
        {
            this.image = null;
            System.out.println("Fichier invalide");
        }
	}
 
	public void paintComponent(Graphics g){
		//Dessine la poignee du levier
		g.setColor(Color.black);
		g.fillRect(20, 20, 50, 100);
		g.drawImage(this.image, 0, 0, this);
	}
 
 
	public void run() {
		// TODO Auto-generated method stub
		while(true){
		try {
			Thread.sleep(30);
			System.out.println("Vitesse :" + levier.getModel().getVitesse(0.03f));
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		}
	}
 
 
} | 
Partager