/*
  * (non-Javadoc)
  *
  * @see javax.swing.plaf.basic.BasicInternalFrameTitlePane#installDefaults()
  */
 @Override
 protected void installDefaults() {
   super.installDefaults();
   if (SubstanceLookAndFeel.isCurrentLookAndFeel()) {
     this.setForeground(
         SubstanceColorUtilities.getForegroundColor(
             SubstanceCoreUtilities.getSkin(this.frame)
                 .getActiveColorScheme(getThisDecorationType())));
   }
   // this.wasClosable = this.frame.isClosable();
 }
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.plaf.basic.BasicInternalFrameTitlePane#setButtonIcons()
   */
  @Override
  protected void setButtonIcons() {
    super.setButtonIcons();
    if (!SubstanceLookAndFeel.isCurrentLookAndFeel()) return;

    Icon restoreIcon =
        new TransitionAwareIcon(
            this.maxButton,
            new TransitionAwareIcon.Delegate() {
              @Override
              public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
                return SubstanceIconFactory.getTitlePaneIcon(
                    SubstanceIconFactory.IconKind.RESTORE,
                    scheme,
                    SubstanceCoreUtilities.getSkin(SubstanceInternalFrameTitlePane.this)
                        .getBackgroundColorScheme(getThisDecorationType()));
              }
            },
            "substance.internalFrame.restoreIcon");
    Icon maximizeIcon =
        new TransitionAwareIcon(
            this.maxButton,
            new TransitionAwareIcon.Delegate() {
              @Override
              public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
                return SubstanceIconFactory.getTitlePaneIcon(
                    SubstanceIconFactory.IconKind.MAXIMIZE,
                    scheme,
                    SubstanceCoreUtilities.getSkin(SubstanceInternalFrameTitlePane.this)
                        .getBackgroundColorScheme(getThisDecorationType()));
              }
            },
            "substance.internalFrame.maxIcon");
    Icon minimizeIcon =
        new TransitionAwareIcon(
            this.iconButton,
            new TransitionAwareIcon.Delegate() {
              @Override
              public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
                return SubstanceIconFactory.getTitlePaneIcon(
                    SubstanceIconFactory.IconKind.MINIMIZE,
                    scheme,
                    SubstanceCoreUtilities.getSkin(SubstanceInternalFrameTitlePane.this)
                        .getBackgroundColorScheme(getThisDecorationType()));
              }
            },
            "substance.internalFrame.minIcon");
    Icon closeIcon =
        new TransitionAwareIcon(
            this.closeButton,
            new TransitionAwareIcon.Delegate() {
              @Override
              public Icon getColorSchemeIcon(SubstanceColorScheme scheme) {
                return SubstanceIconFactory.getTitlePaneIcon(
                    SubstanceIconFactory.IconKind.CLOSE,
                    scheme,
                    SubstanceCoreUtilities.getSkin(SubstanceInternalFrameTitlePane.this)
                        .getBackgroundColorScheme(getThisDecorationType()));
              }
            },
            "substance.internalFrame.closeIcon");
    if (this.frame.isIcon()) {
      this.iconButton.setIcon(restoreIcon);
      this.iconButton.setToolTipText(
          SubstanceCoreUtilities.getResourceBundle(frame).getString("SystemMenu.restore"));
      this.maxButton.setIcon(maximizeIcon);
      this.maxButton.setToolTipText(
          SubstanceCoreUtilities.getResourceBundle(frame).getString("SystemMenu.maximize"));
    } else {
      this.iconButton.setIcon(minimizeIcon);
      this.iconButton.setToolTipText(
          SubstanceCoreUtilities.getResourceBundle(frame).getString("SystemMenu.iconify"));
      if (this.frame.isMaximum()) {
        this.maxButton.setIcon(restoreIcon);
        this.maxButton.setToolTipText(
            SubstanceCoreUtilities.getResourceBundle(frame).getString("SystemMenu.restore"));
      } else {
        this.maxButton.setIcon(maximizeIcon);
        this.maxButton.setToolTipText(
            SubstanceCoreUtilities.getResourceBundle(frame).getString("SystemMenu.maximize"));
      }
    }
    if (closeIcon != null) {
      this.closeButton.setIcon(closeIcon);
      syncCloseButtonTooltip();
    }
  }