< prev index next >

src/share/classes/javax/swing/plaf/synth/Region.java

Print this page
rev 1580 : 6727661: Code improvement and warnings removing from the swing/plaf packages
Summary: Removed unnecessary castings and other warnings
Reviewed-by: alexp
Contributed-by: Florian Brunner <fbrunnerlist@gmx.ch>


 478             context.put(UI_TO_REGION_MAP_KEY, map);
 479         }
 480         return map;
 481     }
 482 
 483     private static Map<Region, String> getLowerCaseNameMap() {
 484         AppContext context = AppContext.getAppContext();
 485         Map<Region, String> map = (Map<Region, String>) context.get(LOWER_CASE_NAME_MAP_KEY);
 486         if (map == null) {
 487             map = new HashMap<Region, String>();
 488             context.put(LOWER_CASE_NAME_MAP_KEY, map);
 489         }
 490         return map;
 491     }
 492 
 493     static Region getRegion(JComponent c) {
 494         return getUItoRegionMap().get(c.getUIClassID());
 495     }
 496 
 497     static void registerUIs(UIDefaults table) {
 498         for (Object key : getUItoRegionMap().keySet()) {
 499             table.put(key, "javax.swing.plaf.synth.SynthLookAndFeel");
 500         }
 501     }
 502 
 503     private final String name;
 504     private final boolean subregion;
 505 
 506     private Region(String name, boolean subregion) {
 507         if (name == null) {
 508             throw new NullPointerException("You must specify a non-null name");
 509         }
 510         this.name = name;
 511         this.subregion = subregion;
 512     }
 513 
 514     /**
 515      * Creates a Region with the specified name. This should only be
 516      * used if you are creating your own <code>JComponent</code> subclass
 517      * with a custom <code>ComponentUI</code> class.
 518      *




 478             context.put(UI_TO_REGION_MAP_KEY, map);
 479         }
 480         return map;
 481     }
 482 
 483     private static Map<Region, String> getLowerCaseNameMap() {
 484         AppContext context = AppContext.getAppContext();
 485         Map<Region, String> map = (Map<Region, String>) context.get(LOWER_CASE_NAME_MAP_KEY);
 486         if (map == null) {
 487             map = new HashMap<Region, String>();
 488             context.put(LOWER_CASE_NAME_MAP_KEY, map);
 489         }
 490         return map;
 491     }
 492 
 493     static Region getRegion(JComponent c) {
 494         return getUItoRegionMap().get(c.getUIClassID());
 495     }
 496 
 497     static void registerUIs(UIDefaults table) {
 498         for (String key : getUItoRegionMap().keySet()) {
 499             table.put(key, "javax.swing.plaf.synth.SynthLookAndFeel");
 500         }
 501     }
 502 
 503     private final String name;
 504     private final boolean subregion;
 505 
 506     private Region(String name, boolean subregion) {
 507         if (name == null) {
 508             throw new NullPointerException("You must specify a non-null name");
 509         }
 510         this.name = name;
 511         this.subregion = subregion;
 512     }
 513 
 514     /**
 515      * Creates a Region with the specified name. This should only be
 516      * used if you are creating your own <code>JComponent</code> subclass
 517      * with a custom <code>ComponentUI</code> class.
 518      *


< prev index next >