Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Multiple nibs in PB/IB?



Thanks, I think this makes some sense. A couple of more questions
if I may. What is retain()? I can't seem to find it in any of the docs I
have.

Also, are there any examples for this sort of thing? The cocoa-java
documentation seems to be rather lacking.

Finally, it seems that it's the case that if I wanted a single controller
in my application I would subclass inside of IB, but not generate
a file. This would let me wire things from one nib to another e.g.

public class MyMainController{
// Stuff
public void loadTheNibThingee(Object sender) { /* IBAction */
NSApplication.loadNibNamed("MyNibFile", this);
}

and the other nib would have a definition of my class and that's
all. Does this make sense.

Oh, and really finally, is there a penalty for calling loadNibNamed
multiple times with the same argument or is the nib data cached?

Many thanks for your assistance.

---Rick

On Wednesday, October 30, 2002, at 04:39 PM, Steve Franks wrote:

You can definitely have more than one NIB in Cocoa/Java programs.
I use many, but I never asked IB to parse existing Java files - only subclassed java.lang.Object
and made the file's owner that class.

I then load the extra NIBS by
{
CashbookViewer editor = new CashbookViewer();
this.retain(editor);
NSApplication.loadNibNamed("CashbookNIB", editor); }
where CashbookViewer would be the class (fully qualified) of File's Owner in NIB file.

As an aside, I find that, in the example above, if editor gets Java garbage collected
then a program crash occurs. I am still not sure what the best way around this problem is,
so I just keep a handle to editor around....

What do people do in situations when they are frequently creating/destroying stuff?
For instance, if I close the window in the CashbookNIB its gone and all released on Cocoa
side, but I still have the editor object referenced in my Java program.

Cheers,
Steve

On Thursday, October 31, 2002, at 05:14 AM, Rick Kitts wrote:

Hello. I'm trying to do something that I thought was simple but may not be. Basically
I'm trying to create another nib inside of my project. (Just to be clear, this is a
cocoa-java application). What I'm doing specifically is following an example
for creating an about box in the book "Building Cocoa Applications" which is
an ObjC book.

Anyway, what I do is create a nib directly in IB choosing the empty cocoa
thing. I want the "File's Owner" in the instances panel to be a specific Java
class so that I can wire it up using the control drag stuff. What I'm finding is
that IB won't parse Java files. At least I can't figure out how to do that.

So this leads me to 2 questions:

1 - Can you have more than 1 nib in a Cocoa-Java appl built with PB/IB?

2 - Can you import a Java class into IB when you create the nib from within
IB (and not PB)?

Kinda frustrated,
---Rick
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.


--
"Think Twice , Do Once, Repeat As Necessary"
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Multiple nibs in PB/IB? (From: Steve Franks <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.