Package org.pushingpixels.substance.api

Examples of org.pushingpixels.substance.api.SubstanceColorScheme


      SubstanceFillPainter fillPainter = SubstanceCoreUtilities
          .getFillPainter(slider);
      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(slider);

      SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, currState);
      SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, ColorSchemeAssociationKind.BORDER,
              currState);

      HashMapKey baseKey = SubstanceCoreUtilities.getHashKey(this.size,
          width, baseFillScheme.getDisplayName(), baseBorderScheme
              .getDisplayName(), fillPainter.getDisplayName(),
          borderPainter.getDisplayName());

      Icon baseLayer = SliderRoundIcon.icons.get(baseKey);
      if (baseLayer == null) {
        baseLayer = getSingleLayer(slider, width, delta, fillPainter,
            borderPainter, baseFillScheme, baseBorderScheme);
        SliderRoundIcon.icons.put(baseKey, baseLayer);
      }

      if (currState.isDisabled() || (activeStates.size() == 1))
        return baseLayer;

      BufferedImage result = SubstanceCoreUtilities.getBlankImage(
          baseLayer.getIconWidth(), baseLayer.getIconHeight());
      Graphics2D g2d = result.createGraphics();
      baseLayer.paintIcon(slider, g2d, 0, 0);

      for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
          .entrySet()) {
        ComponentState activeState = activeEntry.getKey();
        if (activeState == currState)
          continue;

        float contribution = activeEntry.getValue().getContribution();
        if (contribution == 0.0f)
          continue;

        SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey key = SubstanceCoreUtilities.getHashKey(this.size,
            width, fillScheme.getDisplayName(), borderScheme
                .getDisplayName(),
            fillPainter.getDisplayName(), borderPainter
                .getDisplayName());

        Icon layer = SliderRoundIcon.icons.get(key);
View Full Code Here


   */
  public GraphiteAquaSkin() {
    SubstanceSkin.ColorSchemes schemes = SubstanceSkin
        .getColorSchemes("org/pushingpixels/substance/api/skin/graphite.colorschemes");

    SubstanceColorScheme selectedDisabledScheme = schemes
        .get("Graphite Selected Disabled");
    SubstanceColorScheme selectedScheme = schemes.get("Graphite Selected");
    SubstanceColorScheme disabledScheme = schemes.get("Graphite Disabled");

    SubstanceColorScheme enabledScheme = schemes.get("Graphite Enabled");
    SubstanceColorScheme backgroundScheme = schemes
        .get("Graphite Background");

    // use the same color scheme for active and enabled controls
    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        enabledScheme, enabledScheme, disabledScheme);

    // highlight fill scheme + custom alpha for rollover unselected state
    SubstanceColorScheme highlightScheme = schemes.get("Graphite Aqua");
    defaultSchemeBundle.registerHighlightColorScheme(highlightScheme,
        0.75f, ComponentState.ROLLOVER_UNSELECTED);
    defaultSchemeBundle.registerHighlightColorScheme(highlightScheme, 0.9f,
        ComponentState.SELECTED);
    defaultSchemeBundle.registerHighlightColorScheme(highlightScheme, 1.0f,
        ComponentState.ROLLOVER_SELECTED);
    defaultSchemeBundle.registerHighlightColorScheme(highlightScheme, 1.0f,
        ComponentState.ARMED, ComponentState.ROLLOVER_ARMED);

    defaultSchemeBundle.registerColorScheme(highlightScheme,
        ColorSchemeAssociationKind.BORDER,
        ComponentState.ROLLOVER_ARMED,
        ComponentState.ROLLOVER_SELECTED,
        ComponentState.ROLLOVER_UNSELECTED);
    defaultSchemeBundle.registerColorScheme(highlightScheme,
        ColorSchemeAssociationKind.FILL, ComponentState.SELECTED,
        ComponentState.ROLLOVER_SELECTED);

    // border schemes
    SubstanceColorScheme borderScheme = schemes.get("Graphite Border");
    SubstanceColorScheme separatorScheme = schemes
        .get("Graphite Separator");
    defaultSchemeBundle.registerColorScheme(highlightScheme,
        ColorSchemeAssociationKind.HIGHLIGHT_BORDER, ComponentState
            .getActiveStates());
    defaultSchemeBundle.registerColorScheme(borderScheme,
        ColorSchemeAssociationKind.BORDER);
    defaultSchemeBundle.registerColorScheme(separatorScheme,
        ColorSchemeAssociationKind.SEPARATOR);
    defaultSchemeBundle.registerColorScheme(borderScheme,
        ColorSchemeAssociationKind.MARK);

    // text highlight scheme
    defaultSchemeBundle.registerColorScheme(highlightScheme,
        ColorSchemeAssociationKind.TEXT_HIGHLIGHT,
        ComponentState.SELECTED, ComponentState.ROLLOVER_SELECTED);

    defaultSchemeBundle.registerColorScheme(highlightScheme,
        ComponentState.ARMED, ComponentState.ROLLOVER_ARMED);

    defaultSchemeBundle.registerColorScheme(disabledScheme, 0.5f,
        ComponentState.DISABLED_UNSELECTED);
    defaultSchemeBundle.registerColorScheme(selectedDisabledScheme, 0.5f,
        ComponentState.DISABLED_SELECTED);

    defaultSchemeBundle.registerColorScheme(highlightScheme,
        ComponentState.ROLLOVER_SELECTED);
    defaultSchemeBundle.registerColorScheme(selectedScheme,
        ComponentState.SELECTED);

    SubstanceColorScheme tabHighlightScheme = schemes
        .get("Graphite Tab Highlight");
    defaultSchemeBundle.registerColorScheme(tabHighlightScheme,
        ColorSchemeAssociationKind.TAB,
        ComponentState.ROLLOVER_SELECTED);

View Full Code Here

     */
    @Override
    public synchronized void paint(Graphics g) {
      Graphics2D graphics = (Graphics2D) g.create();

      SubstanceColorScheme scheme = SubstanceCoreUtilities.getSkin(this)
          .getActiveColorScheme(
              DecorationAreaType.PRIMARY_TITLE_PANE);

      graphics.setColor(scheme.getDarkColor());
      int w = this.getWidth();
      int h = this.getHeight();

      graphics.drawRect(0, 0, w - 1, h - 1);

      graphics.setColor(scheme.getExtraLightColor());
      graphics.fillRect(1, 1, w - 2, h - 2);

      while (this.graphValues.size() > (w - 2))
        this.graphValues.removeFirst();

      int xOff = w - this.graphValues.size() - 1;
      graphics.setColor(scheme.getMidColor());
      int count = 0;
      for (double value : this.graphValues) {
        int valueH = (int) (value * (h - 2));
        graphics.drawLine(xOff + count, h - 1 - valueH, xOff + count,
            h - 2);
        count++;
      }

      graphics.setFont(UIManager.getFont("Panel.font"));
      FontMetrics fm = graphics.getFontMetrics();

      StringBuffer longFormat = new StringBuffer();
      Formatter longFormatter = new Formatter(longFormat);
      longFormatter.format("%.1fMB / %.1fMB",
          this.currTakenHeapSizeKB / 1024.f,
          this.currHeapSizeKB / 1024.f);
      int strW = fm.stringWidth(longFormat.toString());
      int strH = fm.getAscent() + fm.getDescent();

      graphics.setColor(scheme.getForegroundColor());
      RenderingUtils.installDesktopHints(graphics, this);
      if (strW < (w - 5)) {
        graphics.drawString(longFormat.toString(), (w - strW) / 2,
            (h + strH) / 2 - 2);
      } else {
View Full Code Here

      SubstanceFillPainter fillPainter = SubstanceCoreUtilities
          .getFillPainter(slider);
      SubstanceBorderPainter borderPainter = SubstanceCoreUtilities
          .getBorderPainter(slider);

      SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, currState);
      SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(slider, ColorSchemeAssociationKind.BORDER,
              currState);

      HashMapKey baseKey = SubstanceCoreUtilities.getHashKey(this.size,
          height, slider.getComponentOrientation(), baseFillScheme
              .getDisplayName(), baseBorderScheme
              .getDisplayName(), fillPainter.getDisplayName(),
          borderPainter.getDisplayName(), this.isMirrorred);

      Icon baseLayer = SliderVerticalIcon.icons.get(baseKey);
      if (baseLayer == null) {
        baseLayer = getSingleLayer(slider, height, delta, fillPainter,
            borderPainter, baseFillScheme, baseBorderScheme);
        SliderVerticalIcon.icons.put(baseKey, baseLayer);
      }

      if (currState.isDisabled() || (activeStates.size() == 1))
        return baseLayer;

      BufferedImage result = SubstanceCoreUtilities.getBlankImage(
          baseLayer.getIconWidth(), baseLayer.getIconHeight());
      Graphics2D g2d = result.createGraphics();
      baseLayer.paintIcon(slider, g2d, 0, 0);

      for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
          .entrySet()) {
        ComponentState activeState = activeEntry.getKey();
        if (activeState == currState)
          continue;

        float contribution = activeEntry.getValue().getContribution();
        if (contribution == 0.0f)
          continue;

        SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(slider,
                ColorSchemeAssociationKind.BORDER, activeState);

        HashMapKey key = SubstanceCoreUtilities.getHashKey(this.size,
            height, slider.getComponentOrientation(), fillScheme
                .getDisplayName(), borderScheme
                .getDisplayName(),
            fillPainter.getDisplayName(), borderPainter
                .getDisplayName(), this.isMirrorred);

        Icon layer = SliderVerticalIcon.icons.get(key);
View Full Code Here

  /**
   * Creates a new <code>Business</code> skin.
   */
  public BusinessBlueSteelSkin() {
    SubstanceColorScheme activeScheme = new SteelBlueColorScheme().tint(
        0.15).named("Business Blue Steel Active");
    SubstanceColorScheme enabledScheme = new MetallicColorScheme().tint(
        0.05).named("Business Blue Steel Enabled");
    SubstanceColorScheme disabledScheme = new LightGrayColorScheme().tint(
        0.05).named("Business Blue Steel Disabled");

    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        activeScheme, enabledScheme, disabledScheme);

    SubstanceSkin.ColorSchemes kitchenSinkSchemes = SubstanceSkin
        .getColorSchemes("org/pushingpixels/substance/api/skin/kitchen-sink.colorschemes");
    SubstanceColorScheme highlightColorScheme = kitchenSinkSchemes
        .get("Business Blue Steel Highlight");
    defaultSchemeBundle.registerHighlightColorScheme(highlightColorScheme);
    this.registerDecorationAreaSchemeBundle(defaultSchemeBundle,
        DecorationAreaType.NONE);

    SubstanceColorScheme activeHeaderScheme = activeScheme.saturate(0.2)
        .named("Business Blue Steel Active Header");
    SubstanceColorScheme enabledHeaderScheme = activeScheme.saturate(-0.2)
        .named("Business Blue Steel Enabled Header");
    SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle(
        activeHeaderScheme, enabledHeaderScheme, enabledHeaderScheme);
    headerSchemeBundle.registerColorScheme(enabledHeaderScheme, 0.5f,
        ComponentState.DISABLED_UNSELECTED,
        ComponentState.DISABLED_SELECTED);
    this.registerDecorationAreaSchemeBundle(headerSchemeBundle,
        DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE,
        DecorationAreaType.HEADER, DecorationAreaType.TOOLBAR);

    SubstanceColorScheme activeGeneralScheme = activeScheme.saturate(-0.5)
        .named("Business Blue Steel Active General");
    SubstanceColorScheme enabledGeneralScheme = activeScheme.tint(0.3)
        .saturate(-0.2).named("Business Blue Steel Enabled General");
    SubstanceColorSchemeBundle generalSchemeBundle = new SubstanceColorSchemeBundle(
        activeGeneralScheme, enabledGeneralScheme, disabledScheme);
    generalSchemeBundle.registerColorScheme(enabledGeneralScheme, 0.7f,
        ComponentState.DISABLED_UNSELECTED);
View Full Code Here

     * @return Icon that matches the specified state of the slider thumb.
     */
    private static Icon getIcon(JTree tree, boolean isCollapsed) {
      ComponentState state = ((tree == null) || tree.isEnabled()) ? ComponentState.ENABLED
          : ComponentState.DISABLED_UNSELECTED;
      SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
          .getColorScheme(tree, state);
      SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
          .getColorScheme(tree, ColorSchemeAssociationKind.BORDER,
              state);

      int fontSize = SubstanceSizeUtils.getComponentFontSize(tree);

      HashMapKey key = SubstanceCoreUtilities.getHashKey(fontSize,
          fillScheme.getDisplayName(), borderScheme.getDisplayName(),
          isCollapsed);

      Icon result = TreeIcon.icons.get(key);
      if (result != null)
        return result;
View Full Code Here

   * Creates a new <code>Dust</code> skin.
   */
  public DustSkin() {
    SubstanceSkin.ColorSchemes schemes = SubstanceSkin
        .getColorSchemes("org/pushingpixels/substance/api/skin/dust.colorschemes");
    SubstanceColorScheme activeScheme = schemes.get("Dust Active");
    SubstanceColorScheme enabledScheme = schemes.get("Dust Enabled");

    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        activeScheme, enabledScheme, enabledScheme);
    defaultSchemeBundle.registerColorScheme(enabledScheme, 0.5f,
        ComponentState.DISABLED_UNSELECTED);
    defaultSchemeBundle.registerColorScheme(activeScheme, 0.5f,
        ComponentState.DISABLED_SELECTED);

    // borders
    SubstanceColorScheme borderEnabledScheme = schemes
        .get("Dust Border Enabled");
    SubstanceColorScheme borderActiveScheme = schemes
        .get("Dust Border Active");

    defaultSchemeBundle.registerColorScheme(borderEnabledScheme,
        ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED,
        ComponentState.DISABLED_SELECTED,
        ComponentState.DISABLED_UNSELECTED);
    defaultSchemeBundle.registerColorScheme(borderActiveScheme,
        ColorSchemeAssociationKind.BORDER, ComponentState
            .getActiveStates());
    defaultSchemeBundle.registerColorScheme(borderEnabledScheme,
        ColorSchemeAssociationKind.MARK);

    this.registerDecorationAreaSchemeBundle(defaultSchemeBundle,
        DecorationAreaType.NONE);

    // header color scheme bundle
    SubstanceColorScheme headerActiveScheme = schemes
        .get("Dust Header Active");
    SubstanceColorScheme headerEnabledScheme = schemes
        .get("Dust Header Enabled");

    SubstanceColorScheme headerWatermarkScheme = schemes
        .get("Dust Header Watermark");

    SubstanceColorScheme headerSeparatorScheme = schemes
        .get("Dust Header Separator");

    SubstanceColorScheme headerBorderScheme = schemes
        .get("Dust Header Border");

    SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle(
        headerActiveScheme, headerEnabledScheme, headerEnabledScheme);
    headerSchemeBundle.registerColorScheme(headerEnabledScheme, 0.7f,
View Full Code Here

        .getTransitionTracker();
    StateTransitionTracker.ModelStateInfo modelStateInfo = stateTransitionTracker
        .getModelStateInfo();

    ComponentState currState = modelStateInfo.getCurrModelState();
    SubstanceColorScheme baseFillScheme = SubstanceColorSchemeUtilities
        .getColorScheme(button, currState);
    SubstanceColorScheme baseBorderScheme = SubstanceColorSchemeUtilities
        .getColorScheme(button, ColorSchemeAssociationKind.BORDER,
            currState);

    SubstanceFillPainter fillPainter = SubstanceCoreUtilities
        .isSpinnerButton(button) ? MatteFillPainter.INSTANCE
        : SubstanceImageCreator.SimplisticSoftBorderReverseFillPainter.INSTANCE;

    BufferedImage baseLayer = getPairwiseFullAlphaBackground(button,
        fillPainter, shaper, width, height, side, baseFillScheme,
        baseBorderScheme, toIgnoreOpenSides);
    BufferedImage fullOpacity = null;

    Map<ComponentState, StateTransitionTracker.StateContributionInfo> activeStates = modelStateInfo
        .getStateContributionMap();

    if (currState.isDisabled() || (activeStates.size() == 1)) {
      fullOpacity = baseLayer;
    } else {
      fullOpacity = SubstanceCoreUtilities.getBlankImage(baseLayer
          .getWidth(), baseLayer.getHeight());
      Graphics2D g2fullOpacity = fullOpacity.createGraphics();

      // draw the base layer
      g2fullOpacity.drawImage(baseLayer, 0, 0, null);

      for (Map.Entry<ComponentState, StateTransitionTracker.StateContributionInfo> activeEntry : activeStates
          .entrySet()) {
        ComponentState activeState = activeEntry.getKey();
        if (activeState == currState)
          continue;

        float contribution = activeEntry.getValue().getContribution();
        if (contribution == 0.0f)
          continue;

        SubstanceColorScheme fillScheme = SubstanceColorSchemeUtilities
            .getColorScheme(button, activeState);
        SubstanceColorScheme borderScheme = SubstanceColorSchemeUtilities
            .getColorScheme(button,
                ColorSchemeAssociationKind.BORDER, activeState);
        BufferedImage layer = getPairwiseFullAlphaBackground(button,
            fillPainter, shaper, width, height, side, fillScheme,
            borderScheme, toIgnoreOpenSides);
View Full Code Here

  /**
   * Creates a new <code>Challenger Deep</code> skin.
   */
  public ChallengerDeepSkin() {
    SubstanceColorScheme activeScheme = new UltramarineColorScheme();
    SubstanceColorScheme enabledScheme = activeScheme.tone(0.1f).named(
        "Challenger Deep Enabled");

    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        activeScheme, enabledScheme, enabledScheme);
    defaultSchemeBundle.registerColorScheme(activeScheme, 0.3f,
View Full Code Here

  /**
   * Creates a new <code>Silver Aqua</code> skin.
   */
  public MistAquaSkin() {
    SubstanceColorScheme activeScheme = new AquaColorScheme();
    SubstanceColorScheme enabledScheme = new MetallicColorScheme().shade(
        0.05).named("Mist Aqua Enabled");
    SubstanceColorScheme disabledScheme = new LightGrayColorScheme().tone(
        0.2).named("Mist Aqua Disabled");

    SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
        activeScheme, enabledScheme, disabledScheme);
    this.registerDecorationAreaSchemeBundle(defaultSchemeBundle,
View Full Code Here

TOP

Related Classes of org.pushingpixels.substance.api.SubstanceColorScheme

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.