Java-Cocoa Resources
Where can I find resources on how to program with Java in PBX? I have done a search, with very few results
Any good books or web-based resources? Specifically, I want to do drawing- I can't even figure out how to draw a rectangle
.
???
Thanks,
Steven
Any good books or web-based resources? Specifically, I want to do drawing- I can't even figure out how to draw a rectangle
.???
Thanks,
Steven
How about:
http://developer.apple.com/techpubs/maco...opics.html
They include a Java tutorial, and all reference material has info for Java too.
though you may want to consider learning Objective-C, because among other things, most Cocoa sample code is Obj-C
http://developer.apple.com/techpubs/maco...opics.html
They include a Java tutorial, and all reference material has info for Java too.
though you may want to consider learning Objective-C, because among other things, most Cocoa sample code is Obj-C
I have already looked there- but I can't figure out how to get started. I did the tutorial, but it says nothing about how to draw to the screen
. I would much rather use Java as I already know it.
:confused:
Thanks,
Steven
. I would much rather use Java as I already know it. :confused:
Thanks,
Steven
I've never used Cocoa Java, but hopefully this is still relevant:
Make a custom view in your window with Interface Builder. Subclass NSView, and set the class of your custom view to the new subclass. Choose Java for the language the class is implemented in. Generate the file for the class.
Override the drawRect method for the subclass. In the drawRect method, use NSBezierPath to draw whatever you want. Check out the docs for all the funky things you can do with an NSBezierPath.
Ask again if you have more problems.
Make a custom view in your window with Interface Builder. Subclass NSView, and set the class of your custom view to the new subclass. Choose Java for the language the class is implemented in. Generate the file for the class.
Override the drawRect method for the subclass. In the drawRect method, use NSBezierPath to draw whatever you want. Check out the docs for all the funky things you can do with an NSBezierPath.
Ask again if you have more problems.
Thanks, but it still doesn't work:
It gives this in the Run thingy:
Code:
/* MyView */
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;
public class MyView extends NSView {
public void drawRect(NSRect rect){
NSBezierPath aPath;
aPath = NSBezierPath.bezierPathWithOvalInRect(rect);
aPath.stroke();
}
}It gives this in the Run thingy:
Code:
2002-09-19 15:57:46.688 NSViewTest[686] AppKitJava: uncaught exception NSInvalidArgumentException (_BRIDGEUnmappedInitMethodImp: the java class MyView does not implement any constructor that maps to the Objective C method initWithFrame:.)
2002-09-19 15:57:46.690 NSViewTest[686] AppKitJava: exception = _BRIDGEUnmappedInitMethodImp: the java class MyView does not implement any constructor that maps to the Objective C method initWithFrame:.
2002-09-19 15:57:46.690 NSViewTest[686] AppKitJava: terminating.
NSViewTest has exited with status 1.
Looks like you need a constructor with a specific form. Try something like this:
Code:
public MyView(NSRect rect) {
super(rect);
}
Wow! Hey thanks!!
Steven
Steven

