• 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: Beginner question with sheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Beginner question with sheets


  • Subject: Re: Beginner question with sheets
  • From: Enrico Stamigna <email@hidden>
  • Date: Wed, 19 Mar 2003 12:05:43 +0100

Hello,

Look at the NSSelector parameters list array:

public void closeWindow(Object sender)
{
NSAlertPanel.beginAlertSheet(
"Close Window", "Close", null, "Cancel", window, this,
new NSSelector("closeOrNot", new Class[]
{NSWindow.class, Integer.class, Object.class}),

The second parameter Class should be "int.class" instead of "Integer.class".
Using MacOS X 10.1.5, you should get a "java.lang.NoSuchMethodException".
Do you get a different behaviour?

null, sender, "Do you really want to close the window?");
}

public void closeOrNot(NSWindow sheet, int returnCode, Object contextInfo)
{
System.out.println("returnCode=" + returnCode);
System.out.println("contextInfo=" + contextInfo);
if (returnCode == NSAlertPanel.DefaultReturn)
window.performClose(contextInfo);
}


Enrico Stamigna
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Beginner question with sheets
      • From: Enrico Stamigna <email@hidden>
  • Prev by Date: Re: Window Sheet
  • Next by Date: Re: Trapping window close event
  • Previous by thread: Re: Beginner question with sheets
  • Next by thread: Re: Beginner question with sheets
  • Index(es):
    • Date
    • Thread