1 7 package javax.swing; 8 9 import java.awt.*; 10 11 12 31 public abstract class FocusManager extends DefaultKeyboardFocusManager { 32 33 44 public static final String FOCUS_MANAGER_CLASS_PROPERTY = 45 "FocusManagerClassName"; 46 47 private static boolean enabled = true; 48 49 56 public static FocusManager getCurrentManager() { 57 KeyboardFocusManager manager = 58 KeyboardFocusManager.getCurrentKeyboardFocusManager(); 59 if (manager instanceof FocusManager ) { 60 return (FocusManager )manager; 61 } else { 62 return new DelegatingDefaultFocusManager (manager); 63 } 64 } 65 66 88 public static void setCurrentManager(FocusManager aFocusManager) 89 throws SecurityException 90 { 91 KeyboardFocusManager toSet = 96 (aFocusManager instanceof DelegatingDefaultFocusManager ) 97 ? ((DelegatingDefaultFocusManager )aFocusManager).getDelegate() 98 : aFocusManager; 99 KeyboardFocusManager.setCurrentKeyboardFocusManager(toSet); 100 } 101 102 112 @Deprecated 113 public static void disableSwingFocusManager() { 114 if (enabled) { 115 enabled = false; 116 KeyboardFocusManager.getCurrentKeyboardFocusManager(). 117 setDefaultFocusTraversalPolicy( 118 new DefaultFocusTraversalPolicy()); 119 } 120 } 121 122 130 @Deprecated 131 public static boolean isFocusManagerEnabled() { 132 return enabled; 133 } 134 } 135 136 | Popular Tags |