コード例 #1
0
 public void paintComponent(Graphics g) {
   // In the paint method, all the shapes in ArrayList are
   // copied onto the canvas.
   g.setColor(getBackground());
   g.fillRect(0, 0, getSize().width, getSize().height);
   int top = shapes.size();
   for (int i = 0; i < top; i++) {
     Shape s = (Shape) shapes.get(i);
     s.draw(g);
   }
 }
コード例 #2
0
 @Override
 protected void paintComponent(Graphics g) {
   for (Shape s : shapes) {
     s.draw(g);
   }
 }
コード例 #3
0
ファイル: PaintPanel.java プロジェクト: nipunbhardwaj29/X-Man
 // ========================================================= drawCurrentShape
 private void drawCurrentShape(Graphics2D g2) {
   g2.setColor(_color); // Set the color.
   _shape.draw(g2, _start, _end); // Draw the shape.
 }