• 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: adding menu items and making them work [Java]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: adding menu items and making them work [Java]


  • Subject: Re: adding menu items and making them work [Java]
  • From: Fritz Anderson <email@hidden>
  • Date: Wed, 6 Oct 2004 08:37:36 -0500

My Cocoa-Java is not sharp, and this may be just a typo, but I believe the signature for your closePatient() method is closePatient:, not closePatient:: .

-- F

On 5 Oct 2004, at 7:13 PM, John Spicer wrote:

I'm trying to add an item to a menu and get it to work (enabled).

This is the code:

NSMenu theMenuBar = NSApplication.sharedApplication().mainMenu ();
NSMenuItem theView = theMenuBar.itemWithTitle("View");
NSMenu theViewMenu = theView.submenu();
NSMenuItem item = new NSMenuItem("Herbert, Frank", new NSSelector("choosePatient::", new Class[] {getClass()}), "");
item.setEnabled(true);
item.setTarget(this);
theViewMenu.addItem(item);

public void choosePatient (Object sender)
{
NSApplication.beep ();
}


Everything compiles and runs OK. But the menu item will not enable.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Follow-Ups:
    • Re: adding menu items and making them work [Java]
      • From: "M. Uli Kusterer" <email@hidden>
References: 
 >adding menu items and making them work [Java] (From: John Spicer <email@hidden>)

  • Prev by Date: Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))
  • Next by Date: Re: Binding/KVC : valueForKey: and NSDictionary (was: valid accessor for framework objects. (was: implicit and explicit invocation of description method))
  • Previous by thread: adding menu items and making them work [Java]
  • Next by thread: Re: adding menu items and making them work [Java]
  • Index(es):
    • Date
    • Thread