src/share/classes/java/awt/Choice.java

Print this page

        

@@ -104,10 +104,19 @@
     /*
      * JDK 1.1 serialVersionUID
      */
      private static final long serialVersionUID = -4075310674757313071L;
 
+    static {
+        /* ensure that the necessary native libraries are loaded */
+        Toolkit.loadLibraries();
+        /* initialize JNI field and method ids */
+        if (!GraphicsEnvironment.isHeadless()) {
+            initIDs();
+        }
+    }
+    
     /**
      * Creates a new choice menu. The menu initially has no items in it.
      * <p>
      * By default, the first item added to the choice menu becomes the
      * selected item, until a different selection is made by the user

@@ -709,10 +718,14 @@
         else // skip value for unrecognized key
           s.readObject();
       }
     }
 
+    /**
+     * Initialize JNI field and method IDs
+     */
+    private static native void initIDs();
 
 /////////////////
 // Accessibility support
 ////////////////