• 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: loading a Nib in Java
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: loading a Nib in Java


  • Subject: Re: loading a Nib in Java
  • From: email@hidden
  • Date: Tue, 20 Nov 2001 14:08:53 +0100

Hi,

My answer is not complete because when loading a window I can't make it .orderToFront, but generally speaking, the first thing you have to do, in IB, is to set the file's owner of your second nib to your second nib controller class and then connect the window outlet to the Window (assuming you have an NSWindow outlet in your SecondNibControllerClass).
Then, in PB, from your MainController class, create a new NSWindowController from your secondNib name, instantiate your secondNibControllerClass, and then use myNSWindowController.showWindow(mySecondNibControllerClass).

NSWindowController mySecondNibWindowController = new NSWindowController(secondNibName); // secondNibName comes from secondNibName.nib (forget the .nib)
SecondNibControllerClass mySecondNibControllerClass = new SecondNibControllerClass();
mySecondNibWindowController.showWindow(mySecondNibControllerClass);

This should work but there is a problem myNSWindowController.window() point to null ! I think the problem comes from my connection in IB but I can't fix it. Perhaps you'll find a solution.
The second problem is that I can't overwrite the default constructor of SecondNibControllerClass for passing arguments (obj-C bridge error !?).

Hope this help,

olivier

Le mardi 20 novembre 2001, ` 06:43 , email@hidden a icrit :

Message: 1
Date: Sun, 18 Nov 2001 23:22:26 -0500
Subject: loading a Nib in Java
From: John Timmer <email@hidden>
To: <email@hidden>

In order to cut down on the general chaos of a project, I'm trying to
separate things into a nib per window. Unfortunately, I can't figure out
how to load the nib in Java. The bundle additions that let you do it with a
single message don't seem to have been bridged, leaving me with only
NSWindowController.

Unfortunately, I can't seem to get that to work. I've created an empty nib,
added a window and a custom class, and inserted it into my project. I've
then tried nearly every method imaginable to load it using the
NSWindowController constructor. For example, using the code:

String tempString = theBundle.resourcePath() + "/test.nib";
theWinOwner = new NSWindowController(tempString);

I can see that the appropriate path to my resources folder is in the string,
but things seem to go sour after that. I get the following error:

[2264] -[NSWindowController loadWindow]: failed to load window nib file

I've also tried various gyrations with different NSBundle methods, and none
of them seem to work. I can't tell whether it's something about the nib
creation process that I did wrong, or that I'm pointing the window
controller at the wrong thing.

While i'm on this topic, what happens if you do this when there's more than
one window in the nib you're loading?

Thanks for any help,

Jay


  • Prev by Date: Re: NSTask interaction
  • Next by Date: Re: Launching Application with arguments
  • Previous by thread: Fw-up: Some questions about cocoa graphics2D
  • Next by thread: Re: Distributed Object through the Net
  • Index(es):
    • Date
    • Thread