• 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: Overriding NSApplication in Cocoa-Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Overriding NSApplication in Cocoa-Java


  • Subject: Re: Overriding NSApplication in Cocoa-Java
  • From: Magnus Strand <email@hidden>
  • Date: Mon, 07 Feb 2005 15:51:40 +0100

Hi,
From the docs:

To use a custom subclass of NSApplication, simply send |sharedApplication <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSApplication.html#//apple_ref/doc/uid/20000012/BBCBGBDH>| to your custom class rather than directly to NSApplication. If you create your application in Xcode, set the custom application class on the Project Attributes inspector, and Xcode will update the |main()| function accordingly.
|sharedApplication <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSApplication.html#//apple_ref/doc/uid/20000012/BBCBGBDH>| also initializes the global variable |NSApp|.


Does your |sharedApplication <http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSApplication.html#//apple_ref/doc/uid/20000012/BBCBGBDH> method init |the global variable |NSApp?|

Magnus

André Schaupp wrote:

Hello,

For automatic JUnit-Testing I have to override NSApplication in Java (it should
not open any alert panels for example).
So how do I get the right (my) Application-Object back, when using the
sharedApplication()-Method? If I simply invoke the Constructor of my new Class, sharedApplication() throws
an Exception ("NSInternalInconsistencyException: Creating more than one
Application") the first time its called, because Cocoa wants to create a new NSApplication-Object, although I
instantiated mine.


Thanks for help,
Andre Schaupp

_______________________________________________
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




--
*Magnus Strand *
Systemutvecklare | System Developer, MSc

*Teknik i Media* | Södra Förstadsgatan 2 | 211 43 Malmö | Tel +46 40 601 57 00 | Fax +46 40 601 57 99
Direkt +46 40 601 57 16 | Mobil +46 704 20 57 16 | email@hidden | www.tim.se


/This message contains information that may be privileged or confidential and is the property of Teknik i Media. / /It is intended only for the person to whom it is addressed. If you receive this message in error, please notify the sender immediately and delete all copies of this message. /

_______________________________________________
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


References: 
 >Overriding NSApplication in Cocoa-Java (From: "André Schaupp" <email@hidden>)

  • Prev by Date: cocoa/DVDPlayback example code?
  • Next by Date: Re: OT: .dmg creator
  • Previous by thread: Overriding NSApplication in Cocoa-Java
  • Next by thread: NSString's -(NSSize)sizeWithAttributes returns zero!?
  • Index(es):
    • Date
    • Thread