/**
  * Transforms the figure.
  *
  * @param tx the transformation.
  */
 public void transform(AffineTransform tx) {
   if (TRANSFORM.get(this) != null
       || tx.getType() != (tx.getType() & AffineTransform.TYPE_TRANSLATION)) {
     if (TRANSFORM.get(this) == null) {
       TRANSFORM.basicSet(this, (AffineTransform) tx.clone());
     } else {
       AffineTransform t = TRANSFORM.getClone(this);
       t.preConcatenate(tx);
       TRANSFORM.basicSet(this, t);
     }
   } else {
     for (int i = 0; i < coordinates.length; i++) {
       tx.transform(coordinates[i], coordinates[i]);
     }
     if (FILL_GRADIENT.get(this) != null && !FILL_GRADIENT.get(this).isRelativeToFigureBounds()) {
       Gradient g = FILL_GRADIENT.getClone(this);
       g.transform(tx);
       FILL_GRADIENT.basicSet(this, g);
     }
     if (STROKE_GRADIENT.get(this) != null
         && !STROKE_GRADIENT.get(this).isRelativeToFigureBounds()) {
       Gradient g = STROKE_GRADIENT.getClone(this);
       g.transform(tx);
       STROKE_GRADIENT.basicSet(this, g);
     }
   }
   invalidate();
 }
Exemple #2
0
 public void actionPerformed(ActionEvent e) {
   for (int i = 0; i < colors.length; i++) {
     if (e.getSource().equals(innerMI[i])) {
       demo.innerC = colors[i];
       imenu.setIcon(squares[i]);
       break;
     } else if (e.getSource().equals(outerMI[i])) {
       demo.outerC = colors[i];
       omenu.setIcon(squares[i]);
       break;
     }
   }
   demo.repaint();
 }
Exemple #3
0
 public void run() {
   // goto double buffering
   if (demo.getImageType() <= 1) {
     demo.setImageType(2);
   }
   Thread me = Thread.currentThread();
   while (thread == me) {
     for (int i = 0; i < innerMI.length; i++) {
       if (i != 4) {
         try {
           thread.sleep(4444);
         } catch (InterruptedException e) {
           return;
         }
         innerMI[i].doClick();
       }
     }
   }
   thread = null;
 }