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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 25,39 **** package com.apple.laf; import java.awt.*; import java.awt.event.*; - import java.awt.peer.MenuComponentPeer; import java.util.Hashtable; import javax.swing.*; import sun.awt.SunToolkit; import sun.lwawt.LWToolkit; import sun.lwawt.macosx.*; @SuppressWarnings("serial") // JDK implementation class --- 25,39 ---- package com.apple.laf; import java.awt.*; import java.awt.event.*; import java.util.Hashtable; import javax.swing.*; + import sun.awt.AWTAccessor; import sun.awt.SunToolkit; import sun.lwawt.LWToolkit; import sun.lwawt.macosx.*; @SuppressWarnings("serial") // JDK implementation class
*** 210,237 **** if (target == null && fLastMouseEventTarget == null) return; // Send a mouseExited to the previously hilited item, if it wasn't 0. if (target != fLastMouseEventTarget) { if (fLastMouseEventTarget != null) { ! LWToolkit.postEvent(new MouseEvent(fLastMouseEventTarget, MouseEvent.MOUSE_EXITED, when, modifiers, x - fLastTargetRect.x, y - fLastTargetRect.y, 0, false)); } ! // Send a mouseEntered to the current hilited item, if it wasn't 0. if (target != null) { ! LWToolkit.postEvent(new MouseEvent(target, MouseEvent.MOUSE_ENTERED, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false)); } fLastMouseEventTarget = target; fLastTargetRect = targetRect; } // Post a mouse event to the current item. if (target == null) return; ! LWToolkit.postEvent(new MouseEvent(target, kind, when, modifiers, x - targetRect.x, y - targetRect.y, 0, false)); } }); } @Override - @SuppressWarnings("deprecation") public void addNotify() { synchronized (getTreeLock()) { super.addNotify(); if (fModelPtr == 0) { fInvoker.addContainerListener(this); --- 210,249 ---- if (target == null && fLastMouseEventTarget == null) return; // Send a mouseExited to the previously hilited item, if it wasn't 0. if (target != fLastMouseEventTarget) { if (fLastMouseEventTarget != null) { ! LWToolkit.postEvent( ! new MouseEvent(fLastMouseEventTarget, ! MouseEvent.MOUSE_EXITED, when, ! modifiers, x - fLastTargetRect.x, ! y - fLastTargetRect.y, 0, ! false)); } ! // Send a mouseEntered to the current hilited item, if it ! // wasn't 0. if (target != null) { ! LWToolkit.postEvent( ! new MouseEvent(target, MouseEvent.MOUSE_ENTERED, ! when, modifiers, ! x - targetRect.x, ! y - targetRect.y, 0, false)); } fLastMouseEventTarget = target; fLastTargetRect = targetRect; } // Post a mouse event to the current item. if (target == null) return; ! LWToolkit.postEvent( ! new MouseEvent(target, kind, when, modifiers, ! x - targetRect.x, y - targetRect.y, 0, ! false)); } }); } @Override public void addNotify() { synchronized (getTreeLock()) { super.addNotify(); if (fModelPtr == 0) { fInvoker.addContainerListener(this);
*** 246,256 **** final String tooltipText = fInvoker.getToolTipText(); if (tooltipText != null) { setToolTipText(tooltipText); } ! final MenuComponentPeer peer = getPeer(); if (peer instanceof CMenu) { final CMenu menu = (CMenu) peer; final long nativeMenu = menu.getNativeMenu(); fModelPtr = addMenuListeners(this, nativeMenu); } --- 258,269 ---- final String tooltipText = fInvoker.getToolTipText(); if (tooltipText != null) { setToolTipText(tooltipText); } ! final Object peer = AWTAccessor.getMenuComponentAccessor() ! .getPeer(this); if (peer instanceof CMenu) { final CMenu menu = (CMenu) peer; final long nativeMenu = menu.getNativeMenu(); fModelPtr = addMenuListeners(this, nativeMenu); }
*** 353,375 **** // only check and radio items can be indeterminate @Override public void setIndeterminate(boolean indeterminate) { } @Override - @SuppressWarnings("deprecation") public void setToolTipText(final String text) { ! final MenuComponentPeer peer = getPeer(); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; cmi.setToolTipText(text); } @Override - @SuppressWarnings("deprecation") public void setIcon(final Icon i) { ! final MenuComponentPeer peer = getPeer(); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; Image img = null; --- 366,386 ---- // only check and radio items can be indeterminate @Override public void setIndeterminate(boolean indeterminate) { } @Override public void setToolTipText(final String text) { ! Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; cmi.setToolTipText(text); } @Override public void setIcon(final Icon i) { ! Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this); if (!(peer instanceof CMenuItem)) return; final CMenuItem cmi = (CMenuItem)peer; Image img = null;