Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Create JAVA SubClass MyView in IB not working

Create JAVA SubClass MyView in IB not working
Thread Tools
Fresh-Faced Recruit
Join Date: Aug 2001
Location: Germany
Status: Offline
Reply With Quote
Jan 29, 2002, 03:49 PM
 
Hi,
I've posted some questions about Printing from Cocoa, now I simpleprinting is ok.
Now I want to print different Pages, like that I want to create my own SubClass from NSView.

I want to create it in Interface Builder to use the GUI for Creating the PrintOut.

When I create a simple Subclass MyView and switch it to JAVA, then I always get an Error "Invalid Number of Arguments" in the MyView Class Info Dialog.

What's wrong?
When Compiling the App. is ok, when running it stops with the following error:
"2002-01-29 22:30:49.654 KD[1877] AppKitJava: uncaught exception NSInvalidArgumentException (_BRIDGEUnmappedInitMethodImp: the java class MyView does not implement any constructor that maps to the Objective C method initWithFrame:.)

I hope somebody cna help me?

Mark
     
Mac Elite
Join Date: Sep 2000
Location: in front of the keyboard
Status: Offline
Reply With Quote
Jan 29, 2002, 03:52 PM
 
Originally posted by Mark Goebl:
<STRONG>Hi,
I've posted some questions about Printing from Cocoa, now I simpleprinting is ok.
Now I want to print different Pages, like that I want to create my own SubClass from NSView.

I want to create it in Interface Builder to use the GUI for Creating the PrintOut.

When I create a simple Subclass MyView and switch it to JAVA, then I always get an Error "Invalid Number of Arguments" in the MyView Class Info Dialog.

What's wrong?
When Compiling the App. is ok, when running it stops with the following error:
"2002-01-29 22:30:49.654 KD[1877] AppKitJava: uncaught exception NSInvalidArgumentException (_BRIDGEUnmappedInitMethodImp: the java class MyView does not implement any constructor that maps to the Objective C method initWithFrame:.)

I hope somebody cna help me?

Mark</STRONG>
Make sure you are implementing ALL of the methods of the abstract parent class.
signatures are a waste of bandwidth
especially ones with political tripe in them.
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Jan 29, 2002, 10:55 PM
 
Originally posted by Kristoff:
<STRONG>

Make sure you are implementing ALL of the methods of the abstract parent class.</STRONG>
Uhmmm, actually, all you need to do is add the constructor as so:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
public mySubClassName(NSRect frame)
{
super(frame);
<font color = brown>//any other initialization u would like to do</font>
}
</font>[/code]

And of course, you'll probably want to override this method:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
public void drawRect(NSRect frame)
{
<font color = brown>//drawing code</font>
}
</font>[/code]

I'm not sure if drawRect is abstract or not, but either way you'll probably want to have drawRect(NSRect) described in your subclass.

HTH,
F-bacher
     
Fresh-Faced Recruit
Join Date: Aug 2001
Location: Germany
Status: Offline
Reply With Quote
Feb 1, 2002, 01:05 PM
 
It now works,

I have made an error defining the class (but I don't know which) ;-))

I finally tried to go to the tutorial TempController and looked there how to create a CustomView and it works!!

Thanks to everyone.

Mark
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:35 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2