コード例 #1
0
  /*
   * (non-Javadoc)
   *
   * @see
   * javax.swing.plaf.basic.BasicInternalFrameTitlePane#installListeners()
   */
  @Override
  protected void installListeners() {
    super.installListeners();
    this.substancePropertyListener =
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (JInternalFrame.TITLE_PROPERTY.equals(evt.getPropertyName())) {
              SubstanceInternalFrameTitlePane.this.setToolTipText((String) evt.getNewValue());
            }
            if ("JInternalFrame.messageType".equals(evt.getPropertyName())) {
              updateOptionPaneState();
              frame.repaint();
            }
          }
        };
    this.frame.addPropertyChangeListener(this.substancePropertyListener);

    // Property change listener for pulsating close button
    // when window has been marked as changed.
    this.substanceWinModifiedListener =
        new PropertyChangeListener() {
          @Override
          public void propertyChange(PropertyChangeEvent evt) {
            if (SubstanceLookAndFeel.WINDOW_MODIFIED.equals(evt.getPropertyName())) {
              syncCloseButtonTooltip();
            }
          }
        };
    // Wire it on the root pane.
    this.frame.getRootPane().addPropertyChangeListener(this.substanceWinModifiedListener);
  }
コード例 #2
0
 public void addNotify() {
   super.addNotify();
   // This is done here instead of in installDefaults as I was worried
   // that the BasicInternalFrameUI might not be fully initialized, and
   // that if this resets the closable state the BasicInternalFrameUI
   // Listeners that get notified might be in an odd/uninitialized state.
   updateOptionPaneState();
 }
コード例 #3
0
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.JComponent#addNotify()
  */
 @Override
 public void addNotify() {
   super.addNotify();
   if (Boolean.TRUE.equals(this.getClientProperty(UNINSTALLED))) {
     this.installTitlePane();
     // this.installListeners();
     this.putClientProperty(UNINSTALLED, null);
   }
 }
コード例 #4
0
  /*
   * (non-Javadoc)
   *
   * @see
   * javax.swing.plaf.basic.BasicInternalFrameTitlePane#uninstallListeners()
   */
  @Override
  public void uninstallListeners() {
    this.frame.removePropertyChangeListener(this.substancePropertyListener);
    this.substancePropertyListener = null;

    this.frame.getRootPane().removePropertyChangeListener(this.substanceWinModifiedListener);
    this.substanceWinModifiedListener = null;

    super.uninstallListeners();
  }
コード例 #5
0
 protected void installDefaults() {
   super.installDefaults();
   setFont(UIManager.getFont("InternalFrame.titleFont"));
   paletteTitleHeight = UIManager.getInt("InternalFrame.paletteTitleHeight");
   paletteCloseIcon = UIManager.getIcon("InternalFrame.paletteCloseIcon");
   wasClosable = frame.isClosable();
   selectedForegroundKey = selectedBackgroundKey = null;
   if (MetalLookAndFeel.usingOcean()) {
     setOpaque(true);
   }
 }
コード例 #6
0
 /*
  * (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();
 }
コード例 #7
0
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.plaf.basic.BasicInternalFrameTitlePane#enableActions()
   */
  @Override
  protected void enableActions() {
    super.enableActions();

    if (!this.frame.isIcon()) {
      if (this.maxButton != null)
        this.maxButton.setEnabled(
            this.maximizeAction.isEnabled() || this.restoreAction.isEnabled());
      if (this.iconButton != null) this.iconButton.setEnabled(this.iconifyAction.isEnabled());
    }
  }
コード例 #8
0
  /*
   * (non-Javadoc)
   *
   * @see javax.swing.JComponent#removeNotify()
   */
  @Override
  public void removeNotify() {
    super.removeNotify();

    // fix for defect 211 - internal frames that are iconified
    // programmatically should not uninstall the title panes.
    boolean isAlive =
        ((this.frame.isIcon() && !this.frame.isClosed())
            || Boolean.TRUE.equals(frame.getClientProperty(ICONIFYING)));
    if (!isAlive) {
      this.uninstall();
    }
  }
コード例 #9
0
  protected void createButtons() {
    super.createButtons();

    Boolean paintActive = frame.isSelected() ? Boolean.TRUE : Boolean.FALSE;
    iconButton.putClientProperty("paintActive", paintActive);
    iconButton.setBorder(handyEmptyBorder);

    maxButton.putClientProperty("paintActive", paintActive);
    maxButton.setBorder(handyEmptyBorder);

    closeButton.putClientProperty("paintActive", paintActive);
    closeButton.setBorder(handyEmptyBorder);

    // The palette close icon isn't opaque while the regular close icon is.
    // This makes sure palette close buttons have the right background.
    closeButton.setBackground(MetalLookAndFeel.getPrimaryControlShadow());

    if (MetalLookAndFeel.usingOcean()) {
      iconButton.setContentAreaFilled(false);
      maxButton.setContentAreaFilled(false);
      closeButton.setContentAreaFilled(false);
    }
  }
コード例 #10
0
 protected void uninstallDefaults() {
   super.uninstallDefaults();
   if (wasClosable != frame.isClosable()) {
     frame.setClosable(wasClosable);
   }
 }
コード例 #11
0
 protected void uninstallListeners() {
   // Get around protected method in superclass
   super.uninstallListeners();
 }
コード例 #12
0
 /*
  * (non-Javadoc)
  *
  * @see javax.swing.plaf.basic.BasicInternalFrameTitlePane#createActions()
  */
 @Override
 protected void createActions() {
   super.createActions();
   this.iconifyAction = new SubstanceIconifyAction();
 }
コード例 #13
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();
    }
  }