Package org.jvnet.substance.painter.gradient

Examples of org.jvnet.substance.painter.gradient.SubstanceGradientPainter


    SubstanceColorScheme scheme = SubstanceColorSchemeUtilities
        .getColorScheme(progressBar,
            progressBar.isEnabled() ? ComponentState.DEFAULT
                : ComponentState.DISABLED_UNSELECTED);

    SubstanceGradientPainter gp = SubstanceCoreUtilities
        .getGradientPainter(progressBar);
    if (progressBar.getOrientation() == SwingConstants.HORIZONTAL) {
      BufferedImage back = getDeterminateBackground(progressBar,
          barRectWidth + 1, barRectHeight + 1, scheme, gp,
          progressBar.getOrientation(), this.progressBar
View Full Code Here


  private void paintSliderTrack(Graphics2D graphics, boolean drawInverted,
      SubstanceColorScheme fillColorScheme,
      SubstanceColorScheme borderScheme, int width, int height) {
    Graphics2D g2d = (Graphics2D) graphics.create();

    SubstanceGradientPainter gradientPainter = ClassicGradientPainter.INSTANCE;
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(this.slider);

    int componentFontSize = SubstanceSizeUtils
        .getComponentFontSize(this.slider);
    int borderDelta = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(componentFontSize) / 2.0);
    float radius = SubstanceSizeUtils
        .getClassicButtonCornerRadius(componentFontSize) / 2.0f;
    int borderThickness = (int) SubstanceSizeUtils
        .getBorderStrokeWidth(componentFontSize);

    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        radius, borderDelta, borderThickness, fillColorScheme
            .getDisplayName(), borderScheme.getDisplayName());

    if (!trackCache.containsKey(key)) {
      BufferedImage trackImage = SubstanceCoreUtilities.getBlankImage(
          width + 1, height + 1);
      Graphics2D cacheGraphics = trackImage.createGraphics();

      Shape contour = SubstanceOutlineUtilities.getBaseOutline(width + 1,
          height + 1, radius, null, borderDelta);

      gradientPainter.paintContourBackground(cacheGraphics, slider,
          width, height, contour, false, fillColorScheme,
          fillColorScheme, 0, false, false);

      GeneralPath contourInner = SubstanceOutlineUtilities
          .getBaseOutline(width + 1, height + 1, radius
View Full Code Here

    insets.top /= 2;
    insets.left /= 2;
    insets.bottom /= 2;
    insets.right /= 2;

    SubstanceGradientPainter gp = SubstanceCoreUtilities
        .getGradientPainter(this.slider);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(this.slider);
    float radius = SubstanceSizeUtils
        .getClassicButtonCornerRadius(SubstanceSizeUtils
            .getComponentFontSize(slider)) / 2.0f;
    int borderDelta = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(slider)) / 2.0);

    // fill selected portion
    if (this.slider.isEnabled()) {
      if (this.slider.getOrientation() == SwingConstants.HORIZONTAL) {
        int middleOfThumb = this.thumbRect.x
            + (this.thumbRect.width / 2) - paintRect.x;
        int fillMinX;
        int fillMaxX;

        if (drawInverted) {
          fillMinX = middleOfThumb;
          fillMaxX = width;
        } else {
          fillMinX = 0;
          fillMaxX = middleOfThumb;
        }

        int fillWidth = fillMaxX - fillMinX;
        int fillHeight = height + 1;
        if ((fillWidth > 0) && (fillHeight > 0)) {
          Shape contour = SubstanceOutlineUtilities.getBaseOutline(
              fillWidth, fillHeight, radius, null, borderDelta);
          g2d.translate(fillMinX, 0);
          gp.paintContourBackground(g2d, this.slider, fillWidth,
              fillHeight, contour, false, fillScheme, fillScheme,
              0.0f, false, false);
          borderPainter.paintBorder(g2d, this.slider, fillWidth,
              fillHeight, contour, null, borderScheme,
              borderScheme, 0.0f, false);
        }
      } else {
        int middleOfThumb = this.thumbRect.y
            + (this.thumbRect.height / 2) - paintRect.y;
        int fillMin;
        int fillMax;

        if (this.drawInverted()) {
          fillMin = 0;
          fillMax = middleOfThumb;
          // fix for issue 368 - inverted vertical sliders
          g2d.translate(width + 2 - middleOfThumb, 0);
        } else {
          fillMin = middleOfThumb;
          fillMax = width + 1;
        }

        int fillWidth = fillMax - fillMin;
        int fillHeight = height + 1;
        if ((fillWidth > 0) && (fillHeight > 0)) {
          Shape contour = SubstanceOutlineUtilities.getBaseOutline(
              fillWidth, fillHeight, radius, null, borderDelta);

          gp.paintContourBackground(g2d, this.slider, fillWidth,
              fillHeight, contour, false, fillScheme, fillScheme,
              0.0f, false, false);
          borderPainter.paintBorder(g2d, this.slider, fillWidth,
              fillHeight, contour, null, borderScheme,
              borderScheme, 0.0f, false);
View Full Code Here

      int width, int height, boolean isSelected, float cyclePos,
      int tabPlacement, SubstanceColorScheme colorScheme,
      SubstanceColorScheme colorScheme2,
      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2, boolean paintOnlyBorder) {
    SubstanceGradientPainter gradientPainter = SubstanceCoreUtilities
        .getGradientPainter(tabPane);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(tabPane);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(tabPane);

    int borderDelta = (int) Math.ceil(2.0 * SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(tabPane)));
    int borderInsets = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(tabPane)) / 2.0);
    int dy = 2 + borderDelta;
    Set<Side> straightSides = EnumSet.of(Side.BOTTOM);

    int cornerRadius = height / 3;
    if (shaper instanceof ClassicButtonShaper) {
      cornerRadius = (int) SubstanceSizeUtils
          .getClassicButtonCornerRadius(SubstanceSizeUtils
              .getComponentFontSize(tabPane));
      if ((tabPlacement == TOP) || (tabPlacement == BOTTOM))
        width -= 1;
      else
        height -= 1;
    }

    GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(width,
        height + dy, cornerRadius, straightSides, borderInsets);

    BufferedImage result = SubstanceCoreUtilities.getBlankImage(width,
        height);
    Graphics2D resGraphics = result.createGraphics();

    if (!paintOnlyBorder) {
      gradientPainter.paintContourBackground(resGraphics, tabPane, width,
          height + dy, contour, false, colorScheme, colorScheme2,
          cyclePos, true, colorScheme != colorScheme2);
    }

    int borderThickness = (int) SubstanceSizeUtils
View Full Code Here

      SubstanceConstants.Side side, SubstanceColorScheme colorScheme,
      SubstanceColorScheme colorScheme2,
      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2) {

    SubstanceGradientPainter gradientPainter = SubstanceCoreUtilities
        .getGradientPainter(tabPane);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(tabPane);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(tabPane);
    Component tabComponent = tabPane.getComponentAt(tabIndex);
    Color tabColor = (tabComponent != null) ? tabComponent.getBackground()
        : tabPane.getBackground();
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        isSelected, cyclePos, tabPlacement, gradientPainter
            .getDisplayName(), borderPainter.getDisplayName(),
        shaper.getDisplayName(), tabPlacement == SwingConstants.BOTTOM,
        side.name(), colorScheme.getDisplayName(), colorScheme2
            .getDisplayName(), borderScheme.getDisplayName(),
        borderScheme2.getDisplayName(), tabColor);
View Full Code Here

   */
  private static BufferedImage getCloseButtonImage(JTabbedPane tabPane,
      int width, int height, float cyclePos, boolean toPaintBorder,
      SubstanceColorScheme fillScheme, SubstanceColorScheme fillScheme2,
      SubstanceColorScheme markScheme, SubstanceColorScheme markScheme2) {
    SubstanceGradientPainter gradientPainter = SubstanceCoreUtilities
        .getGradientPainter(tabPane);
    if (gradientPainter == null)
      return null;

    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        toPaintBorder, cyclePos, gradientPainter.getDisplayName(),
        fillScheme.getDisplayName(), fillScheme2.getDisplayName(),
        markScheme.getDisplayName(), markScheme2.getDisplayName());
    BufferedImage result = SubstanceTabbedPaneUI.closeButtonMap.get(key);
    if (result == null) {
      result = SubstanceCoreUtilities.getBlankImage(width, height);
      Graphics2D finalGraphics = (Graphics2D) result.getGraphics();

      if (toPaintBorder) {
        GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(
            width, height, 1, null);
        gradientPainter.paintContourBackground(finalGraphics, tabPane,
            width, height, contour, false, fillScheme, fillScheme2,
            cyclePos, true, fillScheme != fillScheme2);
        // finalGraphics.drawImage(background, 0, 0, null);
        SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
            .getBorderPainter(tabPane);
View Full Code Here

    }

    int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
    int checkMarkSize = SubstanceSizeUtils.getRadioButtonMarkSize(fontSize);

    SubstanceGradientPainter fillPainter = SubstanceCoreUtilities
        .getGradientPainter(button);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(button);

    HashMapKey key = SubstanceCoreUtilities.getHashKey(fontSize,
        checkMarkSize, currState.name(), currState.name(), fillPainter
            .getDisplayName(), borderPainter.getDisplayName(),
        currFillColorScheme.getDisplayName(), prevFillColorScheme
            .getDisplayName(),
        currMarkColorScheme.getDisplayName(), prevMarkColorScheme
            .getDisplayName(), currBorderColorScheme
View Full Code Here

    }

    int fontSize = SubstanceSizeUtils.getComponentFontSize(button);
    int checkMarkSize = SubstanceSizeUtils.getCheckBoxMarkSize(fontSize);

    SubstanceGradientPainter fillPainter = SubstanceCoreUtilities
        .getGradientPainter(button);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(button);

    // System.out.println(prevState + " -> [" + cyclePos + "] " +
    // currState);
    // System.out.println("\t" + prevBorderColorScheme.getDisplayName()
    // + " -> " + currBorderColorScheme.getDisplayName());

    HashMapKey key = SubstanceCoreUtilities.getHashKey(fontSize,
        checkMarkSize, currState.name(), prevState.name(), fillPainter
            .getDisplayName(), borderPainter.getDisplayName(),
        currFillColorScheme.getDisplayName(), prevFillColorScheme
            .getDisplayName(),
        currMarkColorScheme.getDisplayName(), prevMarkColorScheme
            .getDisplayName(), currBorderColorScheme
View Full Code Here

  private static BufferedImage getThumbVertical(JScrollBar scrollBar,
      int width, int height, float cyclePos, SubstanceColorScheme scheme,
      SubstanceColorScheme scheme2, float borderCyclePos,
      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2) {
    SubstanceGradientPainter painter = SubstanceCoreUtilities
        .getGradientPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), scheme2.getDisplayName(), borderScheme
            .getDisplayName(), borderScheme2.getDisplayName(),
        cyclePos, borderCyclePos, painter.getDisplayName(), shaper
            .getDisplayName(), borderPainter.getDisplayName());
    BufferedImage result = SubstanceScrollBarUI.thumbVerticalMap.get(key);
    if (result == null) {
      // System.out.println("Cache miss - computing");
      // System.out.println("New image for vertical thumb");
      float radius = width / 2;
      if (shaper instanceof ClassicButtonShaper)
        radius = SubstanceSizeUtils
            .getClassicButtonCornerRadius(SubstanceSizeUtils
                .getComponentFontSize(scrollBar));

      int borderDelta = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(scrollBar)) / 2.0);
      GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(
          height, width, radius, null, borderDelta);

      result = SubstanceCoreUtilities.getBlankImage(height, width);
      painter.paintContourBackground(result.createGraphics(), scrollBar,
          height, width, contour, false, scheme, scheme2, cyclePos,
          true, scheme != scheme2);

      // int borderThickness = (int) SubstanceSizeUtils
      // .getBorderStrokeWidth(SubstanceSizeUtils
View Full Code Here

  private static BufferedImage getThumbHorizontal(JScrollBar scrollBar,
      int width, int height, float cyclePos, SubstanceColorScheme scheme,
      SubstanceColorScheme scheme2, float borderCyclePos,
      SubstanceColorScheme borderScheme,
      SubstanceColorScheme borderScheme2) {
    SubstanceGradientPainter painter = SubstanceCoreUtilities
        .getGradientPainter(scrollBar);
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(scrollBar);
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(scrollBar);
    // GripPainter gripPainter = SubstanceCoreUtilities.getGripPainter(
    // scrollBar, null);
    // System.out.println(state.name());
    HashMapKey key = SubstanceCoreUtilities.getHashKey(width, height,
        scheme.getDisplayName(), scheme2.getDisplayName(), borderScheme
            .getDisplayName(), borderScheme2.getDisplayName(),
        cyclePos, borderCyclePos, painter.getDisplayName(), shaper
            .getDisplayName(), borderPainter.getDisplayName());
    // + ":"
    // + ((gripPainter != null) ? gripPainter.getDisplayName()
    // : "null");

    float radius = height / 2;
    if (shaper instanceof ClassicButtonShaper)
      radius = SubstanceSizeUtils
          .getClassicButtonCornerRadius(SubstanceSizeUtils
              .getComponentFontSize(scrollBar));
    int borderDelta = (int) Math.floor(SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(scrollBar)) / 2.0);
    GeneralPath contour = SubstanceOutlineUtilities.getBaseOutline(width,
        height, radius, null, borderDelta);
    BufferedImage opaque = SubstanceScrollBarUI.thumbHorizontalMap.get(key);
    if (opaque == null) {
      // System.out.println("New image for horizontal thumb");

      opaque = SubstanceCoreUtilities.getBlankImage(width, height);
      painter.paintContourBackground(opaque.createGraphics(), scrollBar,
          width, height, contour, false, scheme, scheme2, cyclePos,
          true, scheme != scheme2);

      // int borderThickness = (int) SubstanceSizeUtils
      // .getBorderStrokeWidth(SubstanceSizeUtils
View Full Code Here

TOP

Related Classes of org.jvnet.substance.painter.gradient.SubstanceGradientPainter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.