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

adding menu items and making them work [Java]


  • Subject: adding menu items and making them work [Java]
  • From: John Spicer <email@hidden>
  • Date: Tue, 5 Oct 2004 19:13:42 -0500

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. I've tried removing my validation method, etc. Am I missing something obvious? _______________________________________________
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: Fritz Anderson <email@hidden>
  • Prev by Date: Re: Embedding Omni Frameworks
  • Next by Date: hdiutil create fails to work on MacOS X 10.3.5
  • Previous by thread: Re: saving image format problem of NSBMPFileType
  • Next by thread: Re: adding menu items and making them work [Java]
  • Index(es):
    • Date
    • Thread