コード例 #1
0
 @Override
 public void actionPerformed(ActionEvent e) {
   double max = gradient.getMax();
   double min = gradient.getMin();
   p(" Got new min max - redrawing image");
   setMax(max);
   setMin(min);
   this.redrawImage();
 }
コード例 #2
0
 public void setColors(Color[] gradientColors) {
   this.gradientColors = gradientColors;
   colormodel = new ColorModel(gradientColors, getMin(), getMax());
   if (gradient == null) {
     gradient = new GradientPanel(colormodel);
   } else {
     gradient.setColorModel(colormodel);
     gradient.setMax(getMax());
   }
   gradient.setListener(this);
 }
コード例 #3
0
 @Override
 public void repaint() {
   super.repaint();
   if (imagePanel != null) {
     imagePanel.repaint();
   }
   if (gradient != null) {
     gradient.repaint();
   }
 }
コード例 #4
0
  protected void createAndDrawImage() throws IOException {
    if (gradient != null) {
      remove(gradient);
    }
    createImage();
    drawDensityOnImage();
    if (imagePanel != null) {

      imagePanel.setPixPerCol(pixpercol);
      imagePanel.setPixPerRow(pixperrow);
      imagePanel.setBucketSize(wellDensity.getBucketSize());
      imagePanel.setImage(bimage);
      imagePanel.setCoordscale(coordscale);

    } else {

      imagePanel =
          new WellsImagePanel(
              expcontext,
              BORDER,
              bimage,
              pixpercol,
              pixperrow,
              wellDensity.getBucketSize(),
              this,
              nrWidgets);

      imagePanel.setCoordscale(coordscale);
      //   p("WellsImagePanel created");
      add("Center", imagePanel);

      imagePanel.addMouseListener(
          new MouseAdapter() {

            @Override
            public void mouseClicked(MouseEvent e) {

              processClick(e);
            }

            @Override
            public void mouseReleased(MouseEvent e) {

              processClick(e);
            }
          });
      imagePanel.addMouseListener(popAdapter);
    }

    afterImageCreated();
    add("East", gradient);
    gradient.repaint();
    imagePanel.repaint();
    this.repaint();
  }