src/windows/classes/sun/awt/windows/WMenuItemPeer.java

Print this page




 148         WToolkit.executeOnEventHandlerThread(target, new Runnable() {
 149             public void run() {
 150                 postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
 151                                           ((MenuItem)target).
 152                                               getActionCommand(), when,
 153                                           modifiers));
 154             }
 155         });
 156     }
 157 
 158     private static Font defaultMenuFont;
 159 
 160     static {
 161         defaultMenuFont = AccessController.doPrivileged(
 162             new PrivilegedAction <Font> () {
 163                 public Font run() {
 164                     try {
 165                         ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
 166                         return Font.decode(rb.getString("menuFont"));
 167                     } catch (MissingResourceException e) {
 168                         if (log.isLoggable(PlatformLogger.FINE)) {
 169                             log.fine("WMenuItemPeer: " + e.getMessage()+". Using default MenuItem font.", e);
 170                         }
 171                         return new Font("SanSerif", Font.PLAIN, 11);
 172                     }
 173                 }
 174             });
 175     }
 176 
 177     static Font getDefaultFont() {
 178         return defaultMenuFont;
 179     }
 180 
 181     /**
 182      * Initialize JNI field and method IDs
 183      */
 184     private static native void initIDs();
 185 
 186     private native void _setFont(Font f);
 187 
 188     public void setFont(final Font f) {


 148         WToolkit.executeOnEventHandlerThread(target, new Runnable() {
 149             public void run() {
 150                 postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
 151                                           ((MenuItem)target).
 152                                               getActionCommand(), when,
 153                                           modifiers));
 154             }
 155         });
 156     }
 157 
 158     private static Font defaultMenuFont;
 159 
 160     static {
 161         defaultMenuFont = AccessController.doPrivileged(
 162             new PrivilegedAction <Font> () {
 163                 public Font run() {
 164                     try {
 165                         ResourceBundle rb = ResourceBundle.getBundle("sun.awt.windows.awtLocalization");
 166                         return Font.decode(rb.getString("menuFont"));
 167                     } catch (MissingResourceException e) {
 168                         if (log.isLoggable(PlatformLogger.Level.FINE)) {
 169                             log.fine("WMenuItemPeer: " + e.getMessage()+". Using default MenuItem font.", e);
 170                         }
 171                         return new Font("SanSerif", Font.PLAIN, 11);
 172                     }
 173                 }
 174             });
 175     }
 176 
 177     static Font getDefaultFont() {
 178         return defaultMenuFont;
 179     }
 180 
 181     /**
 182      * Initialize JNI field and method IDs
 183      */
 184     private static native void initIDs();
 185 
 186     private native void _setFont(Font f);
 187 
 188     public void setFont(final Font f) {