/** Redefinition de la methode paintComponent() de JComponent */ public void paintComponent(Graphics g) { super.paintComponent(g); for (Shape s : shapes) { s.paint(g); } for (Shape s : shapesCloneList) { s.paint(g); } }
/** RedŽfinition de la mŽthode paintComponent() de JComponent */ public void paintComponent(Graphics g) { super.paintComponent(g); for (Shape s : shapes) { s.paint(g); } notifyObservers(); }
public void paint(Graphics g) { g.setColor(Color.black); super.paint(g); int h = Math.abs(y1 - y2) - 1, w = Math.abs(x1 - x2) - 1; // int x0=x1>x2?x2:x1, y0=y1>y2?y2:y1; int x0 = 0, y0 = 0; g.drawRect(x0, y0, w, h); }
/** this method paints the line. */ public void paint(Graphics g) { super.paint(g); if (GlobalDebug.isOn) System.out.println("Line.paint()"); g.setColor(Color.black); g.drawLine(startX, startY, endX - 1, endY - 1); // g.drawLine(0,0,30,30); /* if (y1 <= y2) { g.drawLine (0,0,x2-x1-1,y2-y1-1); } else { g.drawLine (0,y1-y2-1,x2-x1-1,0); } */ }