コード例 #1
0
 /** Synchronizes the tooltip of the close button. */
 protected void syncCloseButtonTooltip() {
   if (SubstanceCoreUtilities.isInternalFrameModified(this.frame)) {
     this.closeButton.setToolTipText(
         SubstanceCoreUtilities.getResourceBundle(frame).getString("SystemMenu.close")
             + " ["
             + SubstanceCoreUtilities.getResourceBundle(frame)
                 .getString("Tooltip.contentsNotSaved")
             + "]");
   } else {
     this.closeButton.setToolTipText(
         SubstanceCoreUtilities.getResourceBundle(frame).getString("SystemMenu.close"));
   }
   this.closeButton.repaint();
 }
コード例 #2
0
  /*
   * (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();
    }
  }