A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
graphlib_java.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bounding box for {draw,fill}Triangle().
[graphlib_java.git]
/
DrawingWindow.java
diff --git
a/DrawingWindow.java
b/DrawingWindow.java
index
e7766d0
..
08f85e5
100644
(file)
--- 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.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;
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>
* possible de fermer la fenêtre via le gestionnaire de fenêtres.
*
* @author Arnaud Giersch <arnaud.giersch@univ-fcomte.fr>
- * @version 20141
021b
+ * @version 20141
104
*/
public class DrawingWindow {
*/
public class DrawingWindow {
@@
-358,7
+359,9
@@
public class DrawingWindow {
synchronized (image) {
graphics.drawPolygon(poly);
}
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);
}
graphics.drawPolygon(poly);
graphics.fillPolygon(poly);
}
+ Rectangle bounds = poly.getBounds();
+ bounds.setSize(bounds.width + 1, bounds.height + 1);
panel.repaint(poly.getBounds());
}
panel.repaint(poly.getBounds());
}