Re: Java Cocoa - App doesnt work outside of PB
Re: Java Cocoa - App doesnt work outside of PB
- Subject: Re: Java Cocoa - App doesnt work outside of PB
- From: David Remahl <email@hidden>
- Date: Fri, 12 Apr 2002 13:43:55 +0200
Yes, this is a result of the fact that the Finder sets the working directory
to / while PB sets it to the program location.
If you need to access something inside of your bundle, use [[NSBundle
mainBundle] bundlePath] and other *Path methods in NSBundle (including
pathToResource:ofType:.
Sorry for writing this in Objective C...Hope there aren't any differences in
this part of the API.
/ David
>
Sorted!
>
I guess using absolute paths is a bit of a no-no . I changed it to
>
NSImage.imageNamed("crosshair.tif") which is a bit more dynamic
>
>
thanks
>
>
>
>
>
Pascal Pochet <email@hidden> on 12/04/2002 12:25:15 PM
>
>
To: email@hidden
>
cc:
>
Subject: Re: Java Cocoa - App doesnt work outside of PB
>
>
>
> ObjCJava WARNING:jobjc_jvm_newObject(): constructor with signature
>
> (Lcom/apple/cocoa/foundation/NSRect;)V on class mapView failed (should
>
> morph the java exception)
>
> 2002-04-12 11:48:28.965 Trout[3075] AppKitJava: uncaught exception
>
> OBJCJava_RUNTIME_EXCEPTION ((null))
>
> 2002-04-12 11:48:28.965 Trout[3075] AppKitJava: exception = (null
>
> description)
>
> 2002-04-12 11:48:28.965 Trout[3075] AppKitJava: terminating.
>
>
>
> public class mapView extends NSScrollView
>
> {
>
>
>
> private mapPanel thePanel;
>
> NSTextField currentZoom;
>
>
>
> public mapView(NSRect aRect)
>
> {
>
> super(aRect);
>
> setHasVerticalScroller(true);
>
> setHasHorizontalScroller(true);
>
> NSClipView theView = new NSClipView();
>
> thePanel = new mapPanel(new NSRect(0.0f,0.0f,1000.0f,1000.0f));
>
> theView.setDocumentView(thePanel);
>
> setContentView(theView);
>
> NSImage crosshair = new NSImage
>
> ("Trout.app/contents/resources/crosshair.tif",false);
>
> NSCursor theCursor = new NSCursor(crosshair,new NSPoint(8,8));
>
> setDocumentCursor(theCursor);
>
> }
>
> ...
_______________________________________________
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.