src/java.desktop/macosx/classes/com/apple/laf/AquaButtonUI.java

Print this page




 445 
 446         final Border border = b.getBorder();
 447         if (border instanceof AquaButtonBorder) {
 448             ((AquaButtonBorder)border).alterPreferredSize(d);
 449         }
 450 
 451         return d;
 452     }
 453 
 454     public Dimension getMaximumSize(final JComponent c) {
 455         final Dimension d = getPreferredSize(c);
 456 
 457         final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
 458         if (v != null) {
 459             d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
 460         }
 461 
 462         return d;
 463     }
 464 
 465     final static RecyclableSingleton<AquaHierarchyButtonListener> fHierListener = new RecyclableSingletonFromDefaultConstructor<AquaHierarchyButtonListener>(AquaHierarchyButtonListener.class);
 466     static AquaHierarchyButtonListener getAquaHierarchyButtonListener() {
 467         return fHierListener.get();
 468     }
 469 
 470     // We need to know when ordinary JButtons are put on JToolbars, but not JComboBoxButtons
 471     // JToggleButtons always have the same border
 472 
 473     private boolean shouldInstallHierListener(final AbstractButton b) {
 474         return  (b instanceof JButton || b instanceof JToggleButton && !(b instanceof AquaComboBoxButton) && !(b instanceof JCheckBox) && !(b instanceof JRadioButton));
 475     }
 476 
 477     protected void installHierListener(final AbstractButton b) {
 478         if (shouldInstallHierListener(b)) {
 479             // super put the listener in the button's client properties
 480             b.addHierarchyListener(getAquaHierarchyButtonListener());
 481         }
 482     }
 483 
 484     protected void uninstallHierListener(final AbstractButton b) {
 485         if (shouldInstallHierListener(b)) {




 445 
 446         final Border border = b.getBorder();
 447         if (border instanceof AquaButtonBorder) {
 448             ((AquaButtonBorder)border).alterPreferredSize(d);
 449         }
 450 
 451         return d;
 452     }
 453 
 454     public Dimension getMaximumSize(final JComponent c) {
 455         final Dimension d = getPreferredSize(c);
 456 
 457         final View v = (View)c.getClientProperty(BasicHTML.propertyKey);
 458         if (v != null) {
 459             d.width += v.getMaximumSpan(View.X_AXIS) - v.getPreferredSpan(View.X_AXIS);
 460         }
 461 
 462         return d;
 463     }
 464 
 465     static final RecyclableSingleton<AquaHierarchyButtonListener> fHierListener = new RecyclableSingletonFromDefaultConstructor<AquaHierarchyButtonListener>(AquaHierarchyButtonListener.class);
 466     static AquaHierarchyButtonListener getAquaHierarchyButtonListener() {
 467         return fHierListener.get();
 468     }
 469 
 470     // We need to know when ordinary JButtons are put on JToolbars, but not JComboBoxButtons
 471     // JToggleButtons always have the same border
 472 
 473     private boolean shouldInstallHierListener(final AbstractButton b) {
 474         return  (b instanceof JButton || b instanceof JToggleButton && !(b instanceof AquaComboBoxButton) && !(b instanceof JCheckBox) && !(b instanceof JRadioButton));
 475     }
 476 
 477     protected void installHierListener(final AbstractButton b) {
 478         if (shouldInstallHierListener(b)) {
 479             // super put the listener in the button's client properties
 480             b.addHierarchyListener(getAquaHierarchyButtonListener());
 481         }
 482     }
 483 
 484     protected void uninstallHierListener(final AbstractButton b) {
 485         if (shouldInstallHierListener(b)) {