Re: Overriding NSApplication in Cocoa-Java
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