public void paintComponent(final Graphics g) {
    // Graphics2D g_ = (Graphics2D)g;
    // g.clearRect(0, 0, super.getWidth(), super.getHeight());
    super.paintComponent(g);

    // Font oldFont = g.getFont();
    final Rectangle2D startBounds = g.getFontMetrics().getStringBounds(this.startLabel, g);
    final Rectangle2D endBounds = g.getFontMetrics().getStringBounds(this.endLabel, g);

    final InterpolatedColorMap colorMap = this.options.getCurrentColorMap();

    final float[] color = {0, 0, 0};

    final Insets insets = super.getInsets();

    // draw the color ramp
    final int rampStartX = 15;
    final int rampWidth = (int) Math.max(startBounds.getWidth(), endBounds.getWidth());
    final int rampStartY = (int) (startBounds.getHeight() + 3 + insets.top);
    final int rampEndY = (int) (super.getHeight() - endBounds.getHeight() - insets.bottom);
    final int rampHeight = rampEndY - rampStartY;
    final float sampleStep = 1.0f / rampHeight;
    for (int i = 0; i < rampHeight; i++) {
      final float f = sampleStep * i;
      colorMap.getColor(f, color);
      final Color colorObject = new Color(color[0], color[1], color[2]);
      g.setColor(colorObject);
      final int curY = i + rampStartY;
      g.drawLine(rampStartX, curY, rampStartX + rampWidth, curY);
    }

    // draw the labels
    g.setColor(Color.BLACK);
    g.drawString(this.startLabel, rampStartX, (int) startBounds.getHeight());
    g.drawString(this.endLabel, rampStartX, super.getHeight());
  }
 public void mouseClicked(final MouseEvent e) {
   final ColorMapDialog dialog =
       new ColorMapDialog(AppBase.sgetActiveFrame(), this.options.getCurrentColorMap());
   dialog.show();
   super.repaint();
 }