• 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
problem overriding setImage and image methods in NSTextFieldCell in java cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

problem overriding setImage and image methods in NSTextFieldCell in java cocoa


  • Subject: problem overriding setImage and image methods in NSTextFieldCell in java cocoa
  • From: "Nick Emery" <email@hidden>
  • Date: Thu, 18 Oct 2001 13:15:42 +0100
  • Organization: Peramon technology Ltd

hi,

further to my request for information on how to have text and icons in NSTableView cells, i started to write my own subclass of NSTextFieldCell. i've completed it and it all works fine except for the following strange behaviour: if the subclass of NSTextFieldCell includes either of the overridden methods image or setImage, then when you click on the cell in the table, you get the following messages:

2001-10-18 13:00:50.323 Test[2965] ObjCJava: no java object for 0x2c2cc00<MyCell>
2001-10-18 13:00:50.323 Test[2965] ObjCJava: can't forward method description
2001-10-18 13:00:50.323 Test[2965] ObjCJava: no java object for <MyCell: 0x2c2cc00>
2001-10-18 13:00:50.323 Test[2965] ObjCJava: can't forward method setImage:

why is this?

here is a cut down test version to show the generation of the messages in two files MyCell.java and MyObject.java. there is also a nib file which fills in the NSTableView in MyObject.java amongst other things.

------ MyCell.java ------------------------------------------------
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;

public class MyCell extends NSTextFieldCell
{
NSImage img;
public void setImage (NSImage image)
{
img = image;
}
public NSImage image ()
{
return img;
}
}

------ MyObject.java ------------------------------------------------
import com.apple.cocoa.foundation.*;
import com.apple.cocoa.application.*;

public class MyObject
{
NSApplication application;
NSWindow window;
NSTableView table;
NSCell cell;

public void applicationDidFinishLaunching (NSNotification notification)
{
cell = new MyCell ();
NSArray cols = table.tableColumns ();
int size = cols.count ();
for (int i = 0; i < size; i++)
{
NSTableColumn curt = (NSTableColumn)cols.objectAtIndex (i);
curt.setDataCell (cell);
}
}

String[] data = {"Hello,", "world"};
public int numberOfRowsInTableView (NSTableView table)
{
return data.length;
}

public Object tableViewObjectValueForLocation (NSTableView aTableView,
NSTableColumn aTableColumn, int rowIndex)
{
return data[rowIndex];
}
}


References: 
 >Re: Settings an explicit outgoing mailhost when using Message.framework (From: Scott Anguish <email@hidden>)

  • Prev by Date: NSOutlineView and setDoubleAction
  • Next by Date: launchApplication (NSWorkSpace) : the icon is always displayed
  • Previous by thread: Re: Settings an explicit outgoing mailhost when using Message.framework
  • Next by thread: Ownership of nib instances
  • Index(es):
    • Date
    • Thread