Package org.jvnet.substance.painter.border

Examples of org.jvnet.substance.painter.border.SubstanceBorderPainter


        "Office Silver 2007 Outer", new float[] { 0.0f, 0.5f, 1.0f },
        new ColorSchemeSingleColorQuery[] {
            ColorSchemeSingleColorQuery.LIGHT,
            ColorSchemeSingleColorQuery.ULTRADARK,
            ColorSchemeSingleColorQuery.MID });
    SubstanceBorderPainter innerBorderPainter = new DelegateFractionBasedBorderPainter(
        "Office Silver 2007 Inner", outerBorderPainter, new int[] {
            0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF },
        new ColorSchemeTransform() {
          @Override
          public SubstanceColorScheme transform(
View Full Code Here


        / UIManager.getInt("ProgressBar.cycleTime");

    float borderThickness = SubstanceSizeUtils
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(this.progressBar));
    SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
        .getBorderPainter(this.progressBar);
    this.margin = borderPainter.isPaintingInnerContour() ? (int) Math
        .ceil(2.0 * borderThickness) : (int) Math
        .ceil(1.5 * borderThickness);
  }
 
View Full Code Here

      return;

    Component compForQuerying = (rendererPane != null) ? rendererPane : c;
    SubstanceHighlightPainter highlightPainter = SubstanceCoreUtilities
        .getSkin(compForQuerying).getHighlightPainter();
    SubstanceBorderPainter highlightBorderPainter = SubstanceCoreUtilities
        .getHighlightBorderPainter(compForQuerying);
    Graphics2D g2d = (Graphics2D) g.create(rect.x, rect.y, rect.width,
        rect.height);

    if (openSides == null) {
      openSides = EnumSet.noneOf(Side.class);
    }
    if (rect.width * rect.height < 100000) {
      String openKey = "";
      for (Side oSide : openSides) {
        openKey += oSide.name() + "-";
      }

      HashMapKey key = SubstanceCoreUtilities.getHashKey(highlightPainter
          .getDisplayName(), highlightBorderPainter.getDisplayName(),
          rect.width, rect.height, currScheme.getDisplayName(),
          prevScheme.getDisplayName(), currBorderScheme
              .getDisplayName(), prevBorderScheme
              .getDisplayName(), cyclePos, borderAlpha, openKey);
      BufferedImage result = smallCache.get(key);
View Full Code Here

      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
              - borderThickness, null, borderThickness
              + borderDelta);
      borderPainter.paintBorder(cacheGraphics, slider, width + 1,
          height + 1, contour, contourInner, borderScheme,
          borderScheme, 0, false);

      trackCache.put(key, trackImage);
      cacheGraphics.dispose();
View Full Code Here

    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

      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
        .getBorderStrokeWidth(SubstanceSizeUtils
            .getComponentFontSize(tabPane));
    GeneralPath contourInner = borderPainter.isPaintingInnerContour() ? SubstanceOutlineUtilities
        .getBaseOutline(width, height + dy, cornerRadius
            - borderThickness, straightSides, borderThickness
            + borderInsets)
        : null;

    borderPainter.paintBorder(resGraphics, tabPane, width, height + dy,
        contour, contourInner, borderScheme, borderScheme2, cyclePos,
        borderScheme != borderScheme2);

    resGraphics.dispose();
    return result;
View Full Code Here

      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

            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);
        finalGraphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
        borderPainter.paintBorder(finalGraphics, tabPane, width,
            height, contour, null, markScheme, markScheme2,
            cyclePos, markScheme != markScheme2);
      }

      finalGraphics.setStroke(new BasicStroke(SubstanceSizeUtils
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
            .getDisplayName(), prevBorderColorScheme
View Full Code Here

      GeneralPath contour = null;

      // SubstanceGradientPainter painter = new StandardGradientPainter();

      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(button);

      int borderDelta = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(button)) / 2.0);
      BufferedImage finalBackground = SubstanceCoreUtilities
          .getBlankImage(width, height);
      Graphics2D finalGraphics = (Graphics2D) finalBackground
          .getGraphics();
      // finalGraphics.setColor(Color.red);
      // finalGraphics.fillRect(0, 0, width, height);
      finalGraphics.translate(-deltaLeft, -deltaTop);
      if (side != null) {
        switch (side) {
        case TOP:
        case BOTTOM:
          // rotate by 90% for better visuals
          contour = SubstanceOutlineUtilities.getBaseOutline(height
              + deltaTop + deltaBottom, width + deltaLeft
              + deltaRight, radius, null, borderDelta);

          int translateY = height;
          if (SubstanceCoreUtilities.isScrollButton(button)) {
            translateY += (1 + ((side == SubstanceConstants.Side.BOTTOM) ? 1
                : -2));
          }
          AffineTransform at = AffineTransform.getTranslateInstance(
              0, translateY);
          at.rotate(-Math.PI / 2);
          finalGraphics.setTransform(at);

          painter.paintContourBackground(finalGraphics, button,
              height + deltaTop + deltaBottom, width + deltaLeft
                  + deltaRight, contour, false, colorScheme,
              colorScheme2, cyclePos, true,
              colorScheme != colorScheme2);
          if (!noBorder) {
            borderPainter.paintBorder(finalGraphics, button, height
                + deltaTop + deltaBottom, width + deltaLeft
                + deltaRight, contour, null, borderScheme,
                borderScheme2, cyclePos,
                borderScheme != borderScheme2);
          }
          break;
        case RIGHT:
        case LEFT:
          // arrow in horizontal bar
          contour = SubstanceOutlineUtilities.getBaseOutline(width
              + deltaLeft + deltaRight, height + deltaTop
              + deltaBottom, radius, null, borderDelta);

          painter.paintContourBackground(finalGraphics, button, width
              + deltaLeft + deltaRight, height + deltaTop
              + deltaBottom, contour, false, colorScheme,
              colorScheme2, cyclePos, true,
              colorScheme != colorScheme2);
          if (!noBorder) {
            borderPainter.paintBorder(finalGraphics, button, width
                + deltaLeft + deltaRight, height + deltaTop
                + deltaBottom, contour, null, borderScheme,
                borderScheme2, cyclePos,
                borderScheme != borderScheme2);
          }
          break;
        }
      } else {
        contour = SubstanceOutlineUtilities.getBaseOutline(width
            + deltaLeft + deltaRight, height + deltaTop
            + deltaBottom, radius, null, borderDelta);

        painter.paintContourBackground(finalGraphics, button, width
            + deltaLeft + deltaRight, height + deltaTop
            + deltaBottom, contour, false, colorScheme,
            colorScheme2, cyclePos, true,
            colorScheme != colorScheme2);
        if (!noBorder) {
          borderPainter.paintBorder(finalGraphics, button, width
              + deltaLeft + deltaRight, height + deltaTop
              + deltaBottom, contour, null, borderScheme,
              borderScheme2, cyclePos,
              borderScheme != borderScheme2);
        }
View Full Code Here

TOP

Related Classes of org.jvnet.substance.painter.border.SubstanceBorderPainter

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.