/* * (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); }
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(); }
/* * (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); } }
/* * (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(); }
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); } }
/* * (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#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()); } }
/* * (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(); } }
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); } }
protected void uninstallDefaults() { super.uninstallDefaults(); if (wasClosable != frame.isClosable()) { frame.setClosable(wasClosable); } }
protected void uninstallListeners() { // Get around protected method in superclass super.uninstallListeners(); }
/* * (non-Javadoc) * * @see javax.swing.plaf.basic.BasicInternalFrameTitlePane#createActions() */ @Override protected void createActions() { super.createActions(); this.iconifyAction = new SubstanceIconifyAction(); }
/* * (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(); } }