示例#1
0
 /**
  * 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();
 }
示例#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();
 }
示例#3
0
  public HeatMapFrame() throws Exception {
    super("Heat Map Frame");
    double[][] data = HeatMap.generateRampTestData();
    boolean useGraphicsYAxis = true;

    // you can use a pre-defined gradient:
    panel = new HeatMap(data, useGraphicsYAxis, Gradient.GRADIENT_BLUE_TO_RED);

    // or you can also make a custom gradient:
    Color[] gradientColors = new Color[] {Color.blue, Color.green, Color.yellow};
    Color[] customGradient = Gradient.createMultiGradient(gradientColors, 500);
    panel.updateGradient(customGradient);

    // set miscelaneous settings
    panel.setDrawLegend(true);

    panel.setTitle("Height (m)");
    panel.setDrawTitle(true);

    panel.setXAxisTitle("X-Distance (m)");
    panel.setDrawXAxisTitle(true);

    panel.setYAxisTitle("Y-Distance (m)");
    panel.setDrawYAxisTitle(true);

    panel.setCoordinateBounds(0, 6.28, 0, 6.28);
    panel.setDrawXTicks(true);
    panel.setDrawYTicks(true);

    panel.setColorForeground(Color.black);
    panel.setColorBackground(Color.white);

    this.getContentPane().add(panel);
  }
示例#4
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;
 }