Example #1
0
    public void mouseEntered(MouseEvent e) {
      if (isEnabled()) {
        getModel().setRollover(true);

        FadeTracker fadeTracker = FadeTracker.getInstance();

        fadeTracker.trackFadeIn(
            FadeKind.ROLLOVER, SIPCommTextButton.this, true, new ButtonRepaintCallback());
      }
    }
Example #2
0
  /**
   * Paints this button.
   *
   * @param g the <tt>Graphics</tt> object used for painting
   */
  private void internalPaintComponent(Graphics2D g) {
    AntialiasingManager.activateAntialiasing(g);

    // Paint a roll over fade out.
    FadeTracker fadeTracker = FadeTracker.getInstance();

    float visibility = this.getModel().isRollover() ? 1.0f : 0.0f;
    if (fadeTracker.isTracked(this, FadeKind.ROLLOVER)) {
      visibility = fadeTracker.getFade(this, FadeKind.ROLLOVER);
    }

    visibility /= 2;

    if (visibility != 0.0f) {
      g.setColor(new Color(borderColor[0], borderColor[1], borderColor[2], visibility));

      if (bgImage != null)
        g.fillRoundRect(
            (this.getWidth() - bgImage.getWidth(null)) / 2,
            (this.getHeight() - bgImage.getHeight(null)) / 2,
            bgImage.getWidth(null) - 1,
            bgImage.getHeight(null) - 1,
            20,
            20);
      else g.fillRoundRect(0, 0, this.getWidth() - 1, this.getHeight() - 1, 20, 20);
    }

    if (bgImage != null) {
      g.drawImage(
          bgImage,
          (this.getWidth() - bgImage.getWidth(null)) / 2,
          (this.getHeight() - bgImage.getHeight(null)) / 2,
          null);
    } else {
      g.setColor(getBackground());
      g.fillRoundRect(1, 1, this.getWidth() - 2, this.getHeight() - 2, 20, 20);
    }
  }