示例#1
0
 public boolean isActive(Component c) {
   if (c instanceof JComponent) {
     return JTattooUtilities.isActive((JComponent) c);
   } else {
     return true;
   }
 }
示例#2
0
 protected Color[] getThumbColors() {
   if (isRollover || isDragging) {
     return AbstractLookAndFeel.getTheme().getRolloverColors();
   } else if (!JTattooUtilities.isActive(scrollbar)) {
     return AbstractLookAndFeel.getTheme().getInActiveColors();
   } else {
     return AbstractLookAndFeel.getTheme().getThumbColors();
   }
 }
示例#3
0
  public void paintTrack(Graphics g) {
    boolean leftToRight = JTattooUtilities.isLeftToRight(slider);

    g.translate(trackRect.x, trackRect.y);
    int overhang = 4;
    int trackLeft = 0;
    int trackTop = 0;
    int trackRight = 0;
    int trackBottom = 0;

    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      trackBottom = (trackRect.height - 1) - overhang;
      trackTop = trackBottom - (getTrackWidth() - 1);
      trackRight = trackRect.width - 1;
    } else {
      if (leftToRight) {
        trackLeft = (trackRect.width - overhang) - getTrackWidth();
        trackRight = (trackRect.width - overhang) - 1;
      } else {
        trackLeft = overhang;
        trackRight = overhang + getTrackWidth() - 1;
      }
      trackBottom = trackRect.height - 1;
    }

    g.setColor(AbstractLookAndFeel.getFrameColor());
    g.drawRect(trackLeft, trackTop, (trackRight - trackLeft) - 1, (trackBottom - trackTop) - 1);

    int middleOfThumb = 0;
    int fillTop = 0;
    int fillLeft = 0;
    int fillBottom = 0;
    int fillRight = 0;

    if (slider.getOrientation() == JSlider.HORIZONTAL) {
      middleOfThumb = thumbRect.x + (thumbRect.width / 2);
      middleOfThumb -= trackRect.x;
      fillTop = trackTop + 1;
      fillBottom = trackBottom - 2;

      if (!drawInverted()) {
        fillLeft = trackLeft + 1;
        fillRight = middleOfThumb;
      } else {
        fillLeft = middleOfThumb;
        fillRight = trackRight - 2;
      }
      Color colors[] = null;
      if (!JTattooUtilities.isActive(slider)) {
        colors = AbstractLookAndFeel.getTheme().getInActiveColors();
      } else {
        if (slider.isEnabled()) {
          colors = AbstractLookAndFeel.getTheme().getSliderColors();
        } else {
          colors = AbstractLookAndFeel.getTheme().getDisabledColors();
        }
      }
      JTattooUtilities.fillHorGradient(
          g, colors, fillLeft + 2, fillTop + 2, fillRight - fillLeft - 2, fillBottom - fillTop - 2);
      Color cHi = ColorHelper.darker(colors[colors.length - 1], 5);
      Color cLo = ColorHelper.darker(colors[colors.length - 1], 10);
      JTattooUtilities.draw3DBorder(
          g,
          cHi,
          cLo,
          fillLeft + 1,
          fillTop + 1,
          fillRight - fillLeft - 1,
          fillBottom - fillTop - 1);
    } else {
      middleOfThumb = thumbRect.y + (thumbRect.height / 2);
      middleOfThumb -= trackRect.y;
      fillLeft = trackLeft + 1;
      fillRight = trackRight - 2;

      if (!drawInverted()) {
        fillTop = middleOfThumb;
        fillBottom = trackBottom - 2;
      } else {
        fillTop = trackTop + 1;
        fillBottom = middleOfThumb;
      }
      Color colors[] = null;
      if (!JTattooUtilities.isActive(slider)) {
        colors = AbstractLookAndFeel.getTheme().getInActiveColors();
      } else {
        if (slider.isEnabled()) {
          colors = AbstractLookAndFeel.getTheme().getSliderColors();
        } else {
          colors = AbstractLookAndFeel.getTheme().getDisabledColors();
        }
      }
      JTattooUtilities.fillVerGradient(
          g, colors, fillLeft + 2, fillTop + 2, fillRight - fillLeft - 2, fillBottom - fillTop - 2);
      Color cHi = ColorHelper.darker(colors[colors.length - 1], 5);
      Color cLo = ColorHelper.darker(colors[colors.length - 1], 10);
      JTattooUtilities.draw3DBorder(
          g,
          cHi,
          cLo,
          fillLeft + 1,
          fillTop + 1,
          fillRight - fillLeft - 1,
          fillBottom - fillTop - 1);
    }
    g.translate(-trackRect.x, -trackRect.y);
  }