* <a href="Exemple3.java">Exemple3.java</a>
*
* @author Arnaud Giersch <arnaud.giersch@univ-fcomte.fr>
- * @version 20141008
+ * @version Wed, 08 Oct 2014 21:29:23 +0200
+
*/
public class DrawingWindow {
*/
public DrawingWindow(String title, int width, int height) {
- this.title = new String(title);
+ this.title = new String(title);
this.width = width;
this.height = height;
synchronized (image) {
graphics.drawRect(x, y, w, h);
}
- panel.repaint(x, y, w, h);
+ panel.repaint(x, y, w + 1, h + 1);
}
/** Dessine un rectangle plein.
public void fillRect(int x1, int y1, int x2, int y2) {
int x = Math.min(x1, x2);
int y = Math.min(y1, y2);
- int w = Math.abs(x1 - x2);
- int h = Math.abs(y1 - y2);
+ int w = Math.abs(x1 - x2) + 1;
+ int h = Math.abs(y1 - y2) + 1;
synchronized (image) {
graphics.fillRect(x, y, w, h);
}
synchronized (image) {
graphics.drawOval(x - r, y - r, 2 * r, 2 * r);
}
- panel.repaint(x - r, y - r, 2 * r, 2 * r);
+ panel.repaint(x - r, y - r, 2 * r + 1, 2 * r + 1);
}
/**
*/
public void fillCircle(int x, int y, int r) {
synchronized (image) {
+ graphics.drawOval(x - r, y - r, 2 * r, 2 * r);
graphics.fillOval(x - r, y - r, 2 * r, 2 * r);
}
- panel.repaint(x - r, y - r, 2 * r, 2 * r);
+ panel.repaint(x - r, y - r, 2 * r + 1, 2 * r + 1);
}
/**