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 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 53 54 55 56 57 58 59 60 61 62 63
| public void run()
{
while(threadPlayer!=null && this.stopLecture == false)
{
if(this.imageloaded)
{
this.imageloaded = false;
this.getUrlImage();
ImageIcon img = new ImageIcon(UrlImage);
this.imgFromUrl = img.getImage();
this.repaint();
}
}
}
public void paint(Graphics g)
{
int xStart = 0;
int yStart = 0;
if(this.resolution==R320_240 && this.plan == 0)
{
xStart = 160;
yStart = 120;
}
if(this.zoom==ZOOM_TO_640)
g.drawImage(imgFromUrl, 0, 0, 640, 480, 0, 0, 320, 240, this);
else
g.drawImage(this.imgFromUrl, xStart, yStart, this);
if(this.clearRect)
{
g.clearRect(0,0,640,480);
this.clearRect = false;
}
g.dispose();
this.imageloaded = true;
}
private void getUrlImage()
{
try{
StringBuilder sb = new StringBuilder();
String listeCam;
sb.append(this.numCams[0]);
for(int i=1; i<this.mosaique; i++) {
sb.append(",");
sb.append(this.numCams[i]);
}
listeCam = sb.toString();
this.UrlImage = new URL(this.host+"includes/modules/video/createImage.php?act=2&ticket="+this.ticket+"&cam="+listeCam);
}
catch(MalformedURLException e)
{
this.affichError("No connection : "+this.ticket);
}
} |
Partager