src/java.desktop/macosx/classes/com/apple/laf/ScreenMenuItemCheckbox.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,45 ****
package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
- import java.awt.peer.MenuComponentPeer;
import javax.swing.*;
import javax.swing.plaf.ButtonUI;
import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
import sun.lwawt.macosx.*;
@SuppressWarnings("serial") // JDK implementation class
! final class ScreenMenuItemCheckbox extends CheckboxMenuItem implements ActionListener, ComponentListener, ScreenMenuPropertyHandler, ItemListener {
JMenuItem fMenuItem;
MenuContainer fParent;
ScreenMenuItemCheckbox(final JCheckBoxMenuItem mi) {
super(mi.getText(), mi.getState());
--- 25,48 ----
package com.apple.laf;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.plaf.ButtonUI;
import com.apple.laf.AquaMenuItemUI.IndeterminateListener;
+ import sun.awt.AWTAccessor;
import sun.lwawt.macosx.*;
@SuppressWarnings("serial") // JDK implementation class
! final class ScreenMenuItemCheckbox extends CheckboxMenuItem
! implements ActionListener, ComponentListener, ScreenMenuPropertyHandler,
! ItemListener {
!
JMenuItem fMenuItem;
MenuContainer fParent;
ScreenMenuItemCheckbox(final JCheckBoxMenuItem mi) {
super(mi.getText(), mi.getState());
*** 55,70 ****
fMenuItem = mi;
setEnabled(fMenuItem.isEnabled());
}
ScreenMenuPropertyListener fPropertyListener;
! @SuppressWarnings("deprecation")
public void addNotify() {
super.addNotify();
// Avoid the Auto toggle behavior of AWT CheckBoxMenuItem
! CCheckboxMenuItem ccb = (CCheckboxMenuItem) getPeer();
ccb.setAutoToggle(false);
fMenuItem.addComponentListener(this);
fPropertyListener = new ScreenMenuPropertyListener(this);
fMenuItem.addPropertyChangeListener(fPropertyListener);
--- 58,73 ----
fMenuItem = mi;
setEnabled(fMenuItem.isEnabled());
}
ScreenMenuPropertyListener fPropertyListener;
!
public void addNotify() {
super.addNotify();
// Avoid the Auto toggle behavior of AWT CheckBoxMenuItem
! CCheckboxMenuItem ccb = AWTAccessor.getMenuComponentAccessor().getPeer(this);
ccb.setAutoToggle(false);
fMenuItem.addComponentListener(this);
fPropertyListener = new ScreenMenuPropertyListener(this);
fMenuItem.addPropertyChangeListener(fPropertyListener);
*** 153,173 ****
*/
public void componentHidden(final ComponentEvent e) {
setVisible(false);
}
- @SuppressWarnings("deprecation")
public void setToolTipText(final String text) {
! final MenuComponentPeer peer = getPeer();
if (!(peer instanceof CMenuItem)) return;
((CMenuItem)peer).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;
--- 156,174 ----
*/
public void componentHidden(final ComponentEvent e) {
setVisible(false);
}
public void setToolTipText(final String text) {
! Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (!(peer instanceof CMenuItem)) return;
((CMenuItem)peer).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;
*** 206,218 ****
forceSetState(false);
break;
}
}
- @SuppressWarnings("deprecation")
public void setIndeterminate(final boolean indeterminate) {
! final MenuComponentPeer peer = getPeer();
if (peer instanceof CCheckboxMenuItem) {
((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate);
}
}
--- 207,218 ----
forceSetState(false);
break;
}
}
public void setIndeterminate(final boolean indeterminate) {
! Object peer = AWTAccessor.getMenuComponentAccessor().getPeer(this);
if (peer instanceof CCheckboxMenuItem) {
((CCheckboxMenuItem)peer).setIsIndeterminate(indeterminate);
}
}