Package org.jvnet.substance.shaper

Examples of org.jvnet.substance.shaper.SubstanceButtonShaper


      b.putClientProperty(SubstanceButtonUI.BORDER_ORIGINAL, b
          .getBorder());

    trackGlowingIcon(b);

    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(b);

    if (b.getClientProperty(SubstanceButtonUI.BORDER_COMPUTED) == null) {
      b.setBorder(shaper.getButtonBorder(b));
    } else {
      Border currBorder = b.getBorder();
      if (!(currBorder instanceof SubstanceButtonBorder)) {
        b.setBorder(shaper.getButtonBorder(b));
      } else {
        SubstanceButtonBorder sbCurrBorder = (SubstanceButtonBorder) currBorder;
        if (shaper.getClass() != sbCurrBorder.getButtonShaperClass())
          b.setBorder(shaper.getButtonBorder(b));
      }
    }
    b.putClientProperty(SubstanceButtonUI.OPACITY_ORIGINAL, b.isOpaque());
    b.setOpaque(false);
View Full Code Here


   * javax.swing.plaf.ComponentUI#getPreferredSize(javax.swing.JComponent)
   */
  @Override
  public Dimension getPreferredSize(JComponent c) {
    AbstractButton button = (AbstractButton) c;
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(button);

    // fix for defect 263
    Dimension superPref = super.getPreferredSize(button);
    if (superPref == null)
      return null;

    if (shaper == null)
      return superPref;

    Dimension result = shaper.getPreferredSize(button, superPref);
    return result;
  }
View Full Code Here

      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)));
 
View Full Code Here

    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);

    SubstanceSkin skin = SubstanceCoreUtilities.getSkin(tabPane);
View Full Code Here

   *            Tab index.
   * @return Extra width for the specified tab.
   */
  protected int getTabExtraWidth(int tabPlacement, int tabIndex) {
    int extraWidth = 0;
    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(this.tabPane);
    if (shaper instanceof ClassicButtonShaper)
      extraWidth = (int) (2.0 * SubstanceSizeUtils
          .getClassicButtonCornerRadius(SubstanceSizeUtils
              .getComponentFontSize(this.tabPane)));
 
View Full Code Here

    if (isUnbroken) {
      g2d.setColor(this.highlight);
      g2d.drawLine(x, y + h - 1, x + w - 1, y + h - 1);
    } else {
      // Break line to show visual connection to selected tab
      SubstanceButtonShaper shaper = SubstanceCoreUtilities
          .getButtonShaper(this.tabPane);
      int delta = (shaper instanceof ClassicButtonShaper) ? 1 : 0;
      int borderInsets = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(tabPane)) / 2.0);
View Full Code Here

    if (isUnbroken) {
      g2d.setColor(this.highlight);
      g2d.drawLine(x, y, x, y + h);
    } else {
      // Break line to show visual connection to selected tab
      SubstanceButtonShaper shaper = SubstanceCoreUtilities
          .getButtonShaper(this.tabPane);
      int delta = (shaper instanceof ClassicButtonShaper) ? 1 : 0;

      int borderInsets = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
View Full Code Here

    if (isUnbroken) {
      g2d.setColor(this.highlight);
      g2d.drawLine(x + w - 1, y, x + w - 1, y + h);
    } else {
      // Break line to show visual connection to selected tab
      SubstanceButtonShaper shaper = SubstanceCoreUtilities
          .getButtonShaper(this.tabPane);
      int delta = (shaper instanceof ClassicButtonShaper) ? 1 : 0;

      int borderInsets = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
View Full Code Here

    if (isUnbroken) {
      g2d.setColor(this.highlight);
      g2d.drawLine(x, y, x + w - 1, y);
    } else {
      // Break line to show visual connection to selected tab
      SubstanceButtonShaper shaper = SubstanceCoreUtilities
          .getButtonShaper(this.tabPane);
      int delta = (shaper instanceof ClassicButtonShaper) ? 1 : 0;
      int borderInsets = (int) Math.floor(SubstanceSizeUtils
          .getBorderStrokeWidth(SubstanceSizeUtils
              .getComponentFontSize(tabPane)) / 2.0);
View Full Code Here

        cyclePos = highest.getFadePosition();
        if (!highest.isFadingIn())
          cyclePos = 1.0f - cyclePos;
      }

      SubstanceButtonShaper shaper = SubstanceCoreUtilities
          .getButtonShaper(this.scrollbar);
      HashMapKey key = SubstanceCoreUtilities
          .getHashKey(cyclePos, width, height,
              ((leftActiveButton == null) ? "null"
                  : ComponentState.getState(
                      leftActiveButton.getModel(),
                      leftActiveButton).name()),
              ((leftActiveButton == null) ? "null"
                  : SubstanceCoreUtilities
                      .getPrevComponentState(
                          leftActiveButton).name()),
              ((rightActiveButton == null) ? "null"
                  : ComponentState.getState(
                      rightActiveButton.getModel(),
                      rightActiveButton).name()),
              ((rightActiveButton == null) ? "null"
                  : SubstanceCoreUtilities
                      .getPrevComponentState(
                          rightActiveButton).name()),
              ((compLeftState == null) ? "null" : compLeftState
                  .name()),
              ((compRightState == null) ? "null" : compRightState
                  .name()), ((compLeftState == null) ? "null"
                  : SubstanceColorSchemeUtilities
                      .getColorScheme(leftActiveButton,
                          compLeftState)
                      .getDisplayName()),
              ((compRightState == null) ? "null"
                  : SubstanceColorSchemeUtilities
                      .getColorScheme(rightActiveButton,
                          compRightState)
                      .getDisplayName()),
              SubstanceColorSchemeUtilities.getColorScheme(
                  this.scrollbar, ComponentState.DEFAULT)
                  .getDisplayName(), shaper.getDisplayName(),
              SubstanceSizeUtils
                  .getBorderStrokeWidth(SubstanceSizeUtils
                      .getComponentFontSize(scrollbar)));
      // System.out.println(key);
      if (trackFullHorizontalMap.containsKey(key)) {
        // System.out.println("Cache hit");
        return trackFullHorizontalMap.get(key);
      }
      // System.out.println("Cache miss");

      // System.out.println("New image for horizontal track");
      BufferedImage imageBack = getTrackBackHorizontal(this.scrollbar,
          leftActiveButton, rightActiveButton, width, height);
      Graphics2D backGraphics = imageBack.createGraphics();

      BufferedImage imageDefault = getTrackHorizontal(this.scrollbar,
          compLeftState, compRightState, width, height);

      backGraphics.drawImage(imageDefault, 0, 0, null);
      BufferedImage imageActive = getTrackHorizontal(this.scrollbar,
          compLeftState, compRightState, width, height);
      backGraphics.setComposite(AlphaComposite.SrcOver.derive(cyclePos));
      // System.out.println("Painting " + cyclePos);
      backGraphics.drawImage(imageActive, 0, 0, null);

      trackFullHorizontalMap.put(key, imageBack);
      return imageBack;
    }

    SubstanceButtonShaper shaper = SubstanceCoreUtilities
        .getButtonShaper(this.scrollbar);
    HashMapKey key = SubstanceCoreUtilities
        .getHashKey(width, height, ((compLeftState == null) ? "null"
            : ComponentState.getState(leftActiveButton.getModel(),
                leftActiveButton).name()),
            ((compLeftState == null) ? "null"
                : SubstanceCoreUtilities.getPrevComponentState(
                    leftActiveButton).name()),
            ((compRightState == null) ? "null" : ComponentState
                .getState(rightActiveButton.getModel(),
                    rightActiveButton).name()),
            ((compRightState == null) ? "null"
                : SubstanceCoreUtilities.getPrevComponentState(
                    rightActiveButton).name()),
            ((compLeftState == null) ? "null" : compLeftState
                .name()), ((compRightState == null) ? "null"
                : compRightState.name()),
            ((compLeftState == null) ? "null"
                : SubstanceColorSchemeUtilities.getColorScheme(
                    leftActiveButton, compLeftState)
                    .getDisplayName()),
            ((compRightState == null) ? "null"
                : SubstanceColorSchemeUtilities.getColorScheme(
                    rightActiveButton, compRightState)
                    .getDisplayName()),
            SubstanceColorSchemeUtilities.getColorScheme(
                this.scrollbar, ComponentState.DEFAULT)
                .getDisplayName(), shaper.getDisplayName(),
            SubstanceSizeUtils
                .getBorderStrokeWidth(SubstanceSizeUtils
                    .getComponentFontSize(scrollbar)));

    // System.out.println(key);
View Full Code Here

TOP

Related Classes of org.jvnet.substance.shaper.SubstanceButtonShaper

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.