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
| public void paintComponent(Graphics g)
{
super.paintComponent(g);
if (img == null) return;
int w = img.getWidth(this);
int h = img.getHeight(this);
if (!tracker.checkAll(true)) return; //Attende du chargment des images par le Tracker
//CODE MANQUANT POUR MODIFIACATION EVENTUELLE DE L'IMAGE
boolean zoom = (w > getWidth() || h > getHeight());
if (zoom)
{
g.drawImage(img, 0, 0, getWidth(), getHeight(), this);
}
else
{
g.drawImage(img, (getWidth()-w)/2, (getHeight()-h)/2, this);
}
} |
Partager