Re: menu enabling/disabling in Java
Re: menu enabling/disabling in Java
- Subject: Re: menu enabling/disabling in Java
- From: Brian Webster <email@hidden>
- Date: Mon, 23 Jul 2001 13:40:10 -0500
On Monday, July 23, 2001, at 12:33 PM, cocoa-dev-
email@hidden wrote:
I'm trying to independently adjust several menu items in a
contextual menu.
To do so, I'm going through and testing their names, and
returning different
values based on that. At its simplest, my code looks like:
public boolean validateMenuItem(_NSObsoleteMenuItemProtocol menuItem) {
if (menuItem.title() == "Add File") return true;
else return false;
}
The reason that this isn't working is because you are comparing
two string objects to see if they're the same _object_, instead
of comparing to see if they hold the same string contents. You
should use menuItem.title().equals("Add File") instead.
--
Brian Webster
email@hidden
http://www.owlnet.rice.edu/~bwebster