Пример #1
0
 /**
  * Returns the color scheme based on its display name. This method is the only API that is
  * published for use in custom application skins.
  *
  * @param displayName Display name of a color scheme.
  * @return The color scheme with the matching display name.
  */
 public SubstanceColorScheme get(String displayName) {
   for (SubstanceColorScheme scheme : this.schemes) {
     if (scheme.getDisplayName().equals(displayName)) {
       return scheme;
     }
   }
   return null;
 }
Пример #2
0
 /**
  * Returns the index of the color scheme that has the specified display name. This method is for
  * internal use only and should not be used in custom application skins.
  *
  * @param displayName Display name of a color scheme.
  * @return The index of the color scheme that has the specified display name.
  */
 private int indexOf(String displayName) {
   for (int i = 0; i < this.schemes.size(); i++) {
     SubstanceColorScheme curr = this.schemes.get(i);
     if (curr.getDisplayName().equals(displayName)) {
       return i;
     }
   }
   return -1;
 }
Пример #3
0
  /** Creates a new <code>Autumn</code> skin. */
  public AutumnSkin() {
    SubstanceSkin.ColorSchemes schemes =
        SubstanceSkin.getColorSchemes("org/pushingpixels/substance/api/skin/autumn.colorschemes");

    SubstanceColorScheme activeScheme = schemes.get("Autumn Active");
    SubstanceColorScheme enabledScheme = schemes.get("Autumn Enabled");
    SubstanceColorScheme disabledScheme = enabledScheme;

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

    this.registerDecorationAreaSchemeBundle(defaultSchemeBundle, DecorationAreaType.NONE);

    SubstanceColorSchemeBundle titlePaneSchemeBundle =
        new SubstanceColorSchemeBundle(activeScheme, enabledScheme, disabledScheme);
    titlePaneSchemeBundle.registerColorScheme(
        disabledScheme, 0.6f, ComponentState.DISABLED_UNSELECTED);
    titlePaneSchemeBundle.registerColorScheme(activeScheme, 0.6f, ComponentState.DISABLED_SELECTED);

    SubstanceColorScheme borderScheme = enabledScheme.saturate(0.2f);
    titlePaneSchemeBundle.registerColorScheme(
        borderScheme, ColorSchemeAssociationKind.BORDER, ComponentState.ENABLED);

    this.registerDecorationAreaSchemeBundle(
        titlePaneSchemeBundle,
        activeScheme,
        DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE);

    SubstanceColorScheme watermarkScheme = schemes.get("Autumn Watermark");

    this.registerAsDecorationArea(
        activeScheme,
        DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE,
        DecorationAreaType.HEADER);

    this.registerAsDecorationArea(
        watermarkScheme,
        DecorationAreaType.GENERAL,
        DecorationAreaType.FOOTER,
        DecorationAreaType.TOOLBAR);

    // add an overlay painter to paint a drop shadow along the top
    // edge of toolbars
    this.addOverlayPainter(TopShadowOverlayPainter.getInstance(), DecorationAreaType.TOOLBAR);

    // add an overlay painter to paint separator lines along the bottom
    // edges of title panes and menu bars
    this.bottomLineOverlayPainter = new BottomLineOverlayPainter(ColorSchemeSingleColorQuery.DARK);
    this.addOverlayPainter(
        this.bottomLineOverlayPainter,
        DecorationAreaType.PRIMARY_TITLE_PANE,
        DecorationAreaType.SECONDARY_TITLE_PANE,
        DecorationAreaType.HEADER);

    this.buttonShaper = new ClassicButtonShaper();
    this.fillPainter = new MatteFillPainter();
    this.borderPainter =
        new CompositeBorderPainter(
            "Autumn",
            new ClassicBorderPainter(),
            new DelegateBorderPainter(
                "Autumn Inner",
                new ClassicBorderPainter(),
                new ColorSchemeTransform() {
                  @Override
                  public SubstanceColorScheme transform(SubstanceColorScheme scheme) {
                    return scheme.tint(0.8f);
                  }
                }));

    this.highlightPainter = new ClassicHighlightPainter();

    MarbleNoiseDecorationPainter decorationPainter = new MarbleNoiseDecorationPainter();
    decorationPainter.setTextureAlpha(0.7f);
    this.decorationPainter = decorationPainter;
  }