Re: Java-Cocoa drawing -- help!
Re: Java-Cocoa drawing -- help!
- Subject: Re: Java-Cocoa drawing -- help!
- From: Shawn Erickson <email@hidden>
- Date: Mon, 12 Apr 2004 08:49:20 -0700
On Apr 12, 2004, at 8:12 AM, James Burton wrote:
I guess I'm dense about how to subclass NSView -- do I do that via IB?
If so, How do I connect it to the NSView I placed in my main window?
Or is this simply a matter of putting the following in my controller
source --
public class myview extends NSView {
public void drawRect(NSRect rect) {
NSRect nr = new NSRect(0,0,40,40);
NSBezierPath BP = NSBezierPath.bezierPath();
NSColor.colorWithCalibratedRGB(1f, 0f, 0f, 0.5f).set();
BP.fillRect(nr);
}
}
If you are using IB which it sounds like you are then you need to have
IB read in your file to understand that your sub-class exists
("Classes" menu). Then drag and drop a custom view (found on the cocoa
container panel) as you want into your window and then set that views
class to your custom class (bring up the inspector "show info" on the
custom view and then goto the custom class panel). Save and recompile.
-Shawn
_______________________________________________
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.