src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItem.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,43 ****
package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
- import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import sun.lwawt.macosx.CMenuItem;
@SuppressWarnings("serial") // JDK implementation class
! final class ScreenMenuItem extends MenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler {
ScreenMenuPropertyListener fListener;
JMenuItem fMenuItem;
ScreenMenuItem(final JMenuItem mi) {
super(mi.getText());
--- 25,46 ----
package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
+ import sun.awt.AWTAccessor;
import sun.lwawt.macosx.CMenuItem;
@SuppressWarnings("serial") // JDK implementation class
! final class ScreenMenuItem extends MenuItem
! implements ActionListener, ComponentListener,
! ScreenMenuPropertyHandler {
!
ScreenMenuPropertyListener fListener;
JMenuItem fMenuItem;
ScreenMenuItem(final JMenuItem mi) {
super(mi.getText());
*** 95,107 ****
fMenuItem.removePropertyChangeListener(fListener);
fListener = null;
fMenuItem.removeComponentListener(this);
}
- @SuppressWarnings("deprecation")
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
! final MenuComponentPeer peer = menuItem.getPeer();
if (!(peer instanceof CMenuItem)) {
//Is it possible?
return;
}
final CMenuItem cmi = (CMenuItem) peer;
--- 98,109 ----
fMenuItem.removePropertyChangeListener(fListener);
fListener = null;
fMenuItem.removeComponentListener(this);
}
static void syncLabelAndKS(MenuItem menuItem, String label, KeyStroke ks) {
! Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(menuItem);
if (!(peer instanceof CMenuItem)) {
//Is it possible?
return;
}
final CMenuItem cmi = (CMenuItem) peer;
*** 164,185 ****
if (parent != null) {
((ScreenMenuPropertyHandler)parent).setChildVisible(fMenuItem, b);
}
}
- @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);
}
- @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;
--- 166,185 ----
if (parent != null) {
((ScreenMenuPropertyHandler)parent).setChildVisible(fMenuItem, b);
}
}
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);
}
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;