• 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: Java-Cocoa drawing -- help!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Java-Cocoa drawing -- help! (From: James Burton <email@hidden>)
 >Re: Java-Cocoa drawing -- help! (From: Moray Taylor <email@hidden>)
 >Re: Java-Cocoa drawing -- help! (From: James Burton <email@hidden>)

  • Prev by Date: CPU Speed ...
  • Next by Date: Re: NSTextView Image Issues
  • Previous by thread: Re: Java-Cocoa drawing -- help!
  • Next by thread: Re: Java-Cocoa drawing -- help!
  • Index(es):
    • Date
    • Thread