src/share/classes/sun/awt/SunToolkit.java

Print this page




2001         if (type == null) return false;
2002 
2003         return isInstanceOf(obj.getClass(), type);
2004     }
2005 
2006     private static boolean isInstanceOf(Class<?> cls, String type) {
2007         if (cls == null) return false;
2008 
2009         if (cls.getName().equals(type)) {
2010             return true;
2011         }
2012 
2013         for (Class<?> c : cls.getInterfaces()) {
2014             if (c.getName().equals(type)) {
2015                 return true;
2016             }
2017         }
2018         return isInstanceOf(cls.getSuperclass(), type);
2019     }
2020 













2021     ///////////////////////////////////////////////////////////////////////////
2022     //
2023     // The following methods help set and identify whether a particular
2024     // AWTEvent object was produced by the system or by user code. As of this
2025     // writing the only consumer is the Java Plug-In, although this information
2026     // could be useful to more clients and probably should be formalized in
2027     // the public API.
2028     //
2029     ///////////////////////////////////////////////////////////////////////////
2030 
2031     public static void setSystemGenerated(AWTEvent e) {
2032         AWTAccessor.getAWTEventAccessor().setSystemGenerated(e);
2033     }
2034 
2035     public static boolean isSystemGenerated(AWTEvent e) {
2036         return AWTAccessor.getAWTEventAccessor().isSystemGenerated(e);
2037     }
2038 
2039 } // class SunToolkit
2040 




2001         if (type == null) return false;
2002 
2003         return isInstanceOf(obj.getClass(), type);
2004     }
2005 
2006     private static boolean isInstanceOf(Class<?> cls, String type) {
2007         if (cls == null) return false;
2008 
2009         if (cls.getName().equals(type)) {
2010             return true;
2011         }
2012 
2013         for (Class<?> c : cls.getInterfaces()) {
2014             if (c.getName().equals(type)) {
2015                 return true;
2016             }
2017         }
2018         return isInstanceOf(cls.getSuperclass(), type);
2019     }
2020 
2021     protected static LightweightFrame getLightweightFrame(Component c) {
2022         for (; c != null; c = c.getParent()) {
2023             if (c instanceof LightweightFrame) {
2024                 return (LightweightFrame)c;
2025             }
2026             if (c instanceof Window) {
2027                 // Don't traverse owner windows
2028                 return null;
2029             }
2030         }
2031         return null;
2032     }
2033 
2034     ///////////////////////////////////////////////////////////////////////////
2035     //
2036     // The following methods help set and identify whether a particular
2037     // AWTEvent object was produced by the system or by user code. As of this
2038     // writing the only consumer is the Java Plug-In, although this information
2039     // could be useful to more clients and probably should be formalized in
2040     // the public API.
2041     //
2042     ///////////////////////////////////////////////////////////////////////////
2043 
2044     public static void setSystemGenerated(AWTEvent e) {
2045         AWTAccessor.getAWTEventAccessor().setSystemGenerated(e);
2046     }
2047 
2048     public static boolean isSystemGenerated(AWTEvent e) {
2049         return AWTAccessor.getAWTEventAccessor().isSystemGenerated(e);
2050     }
2051 
2052 } // class SunToolkit
2053