1 30 31 package com.jgoodies.looks.windows; 32 33 import java.beans.PropertyChangeListener ; 34 35 import javax.swing.AbstractButton ; 36 import javax.swing.JComponent ; 37 import javax.swing.plaf.ComponentUI ; 38 39 import com.jgoodies.looks.LookUtils; 40 import com.jgoodies.looks.Options; 41 import com.jgoodies.looks.common.ButtonMarginListener; 42 43 53 public final class WindowsButtonUI extends com.sun.java.swing.plaf.windows.WindowsButtonUI { 54 55 private static final WindowsButtonUI INSTANCE = new WindowsButtonUI(); 56 57 private PropertyChangeListener buttonMarginListener; 58 59 public static ComponentUI createUI(JComponent b) { 60 return INSTANCE; 61 } 62 63 66 protected void installDefaults(AbstractButton b) { 67 super.installDefaults(b); 68 LookUtils.installNarrowMargin(b, getPropertyPrefix()); 69 } 70 71 74 public void installListeners(AbstractButton b) { 75 super.installListeners(b); 76 if (buttonMarginListener == null) { 77 buttonMarginListener = new ButtonMarginListener(getPropertyPrefix()); 78 } 79 b.addPropertyChangeListener(Options.IS_NARROW_KEY, buttonMarginListener); 80 } 81 82 85 public void uninstallListeners(AbstractButton b) { 86 super.uninstallListeners(b); 87 b.removePropertyChangeListener(buttonMarginListener); 88 } 89 90 } | Popular Tags |