• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: menu enabling/disabling in Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: menu enabling/disabling in Java
      • From: Henri Lamiraux <email@hidden>
  • Prev by Date: Re: Bundle and multiple classes (ScreenSaver related stuff)
  • Next by Date: Re: C question about structs
  • Previous by thread: menu enabling/disabling in Java
  • Next by thread: Re: menu enabling/disabling in Java
  • Index(es):
    • Date
    • Thread