From 147524588337beed8ccc0b3981a6e06341082348 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 4 Nov 2014 14:53:57 +0100 Subject: [PATCH] Fix bounding box for {draw,fill}Triangle(). --- DrawingWindow.java | 9 +++++++-- overview.html | 3 +++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/DrawingWindow.java b/DrawingWindow.java index e7766d0..08f85e5 100644 --- a/DrawingWindow.java +++ b/DrawingWindow.java @@ -7,6 +7,7 @@ import java.awt.Graphics2D; import java.awt.Graphics; import java.awt.Point; import java.awt.Polygon; +import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; @@ -34,7 +35,7 @@ import javax.swing.JPanel; * possible de fermer la fenêtre via le gestionnaire de fenêtres. * * @author Arnaud Giersch <arnaud.giersch@univ-fcomte.fr> - * @version 20141021b + * @version 20141104 */ public class DrawingWindow { @@ -358,7 +359,9 @@ public class DrawingWindow { synchronized (image) { graphics.drawPolygon(poly); } - panel.repaint(poly.getBounds()); + Rectangle bounds = poly.getBounds(); + bounds.setSize(bounds.width + 1, bounds.height + 1); + panel.repaint(bounds); } /** @@ -380,6 +383,8 @@ public class DrawingWindow { graphics.drawPolygon(poly); graphics.fillPolygon(poly); } + Rectangle bounds = poly.getBounds(); + bounds.setSize(bounds.width + 1, bounds.height + 1); panel.repaint(poly.getBounds()); } diff --git a/overview.html b/overview.html index c5058e8..26552c9 100644 --- a/overview.html +++ b/overview.html @@ -39,6 +39,9 @@

Modifications

+-- mar.  4 nov. 2014
+        * Correction de la boîte englobante pour {draw,fill}Triangle().
+
 -- mar. 21 oct. 2014
         * Les méthodes *sleep() sont `public'.
         * Vérification des coordonnées dans drawPoint().
-- 
2.20.1