src/macosx/classes/com/apple/laf/ScreenMenu.java

Print this page




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.laf;
  27 
  28 import java.awt.*;
  29 import java.awt.event.*;
  30 import java.awt.peer.MenuComponentPeer;
  31 import java.security.PrivilegedAction;
  32 import java.util.Hashtable;
  33 
  34 import javax.swing.*;
  35 
  36 import sun.lwawt.LWToolkit;
  37 import sun.lwawt.macosx.*;
  38 
  39 class ScreenMenu extends Menu implements ContainerListener, ComponentListener, ScreenMenuPropertyHandler {
  40     static {
  41         java.security.AccessController.doPrivileged((PrivilegedAction<?>)new sun.security.action.LoadLibraryAction("awt"));




  42     }


  43 
  44     // screen menu stuff
  45     public static native long addMenuListeners(ScreenMenu listener, long nativeMenu);
  46     public static native void removeMenuListeners(long modelPtr);
  47 
  48     long fModelPtr = 0;
  49 
  50     Hashtable<Component, MenuItem> fItems;
  51     JMenu fInvoker;
  52 
  53     Component fLastMouseEventTarget;
  54     Rectangle fLastTargetRect;
  55     private volatile Rectangle[] fItemBounds;
  56 
  57     // Array of child hashes used to see if we need to recreate the Menu.
  58     int childHashArray[];
  59 
  60     ScreenMenu(final JMenu invoker) {
  61         super(invoker.getText());
  62         fInvoker = invoker;




  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.laf;
  27 
  28 import java.awt.*;
  29 import java.awt.event.*;
  30 import java.awt.peer.MenuComponentPeer;

  31 import java.util.Hashtable;
  32 
  33 import javax.swing.*;
  34 
  35 import sun.lwawt.LWToolkit;
  36 import sun.lwawt.macosx.*;
  37 
  38 class ScreenMenu extends Menu implements ContainerListener, ComponentListener, ScreenMenuPropertyHandler {
  39     static {
  40         java.security.AccessController.doPrivileged(
  41             new java.security.PrivilegedAction<Void>() {
  42                 public Void run() {
  43                     System.loadLibrary("awt");
  44                     return null;
  45                 }
  46             });
  47     }
  48 
  49     // screen menu stuff
  50     public static native long addMenuListeners(ScreenMenu listener, long nativeMenu);
  51     public static native void removeMenuListeners(long modelPtr);
  52 
  53     long fModelPtr = 0;
  54 
  55     Hashtable<Component, MenuItem> fItems;
  56     JMenu fInvoker;
  57 
  58     Component fLastMouseEventTarget;
  59     Rectangle fLastTargetRect;
  60     private volatile Rectangle[] fItemBounds;
  61 
  62     // Array of child hashes used to see if we need to recreate the Menu.
  63     int childHashArray[];
  64 
  65     ScreenMenu(final JMenu invoker) {
  66         super(invoker.getText());
  67         fInvoker = invoker;