Subj : Re: Implementing Java Interfaces NOT using Rhino To : netscape.public.mozilla.jseng From : Martin Honnen Date : Thu Jul 15 2004 08:20 pm Keno Albrecht wrote: > Hm, I see what you mean, but if I try the following example, I get the > error "There is no Java method javax.swing.JButton.addActionListener > that matches JavaScript argument types (object). Candidate methods with > the same name are: void addActionListener(java.awt.event.ActionListener) > > var actionListener = { > actionPerformed: function() { > java.lang.System.out.println("Say Cheese"); > } > } > > var frame = new Packages.javax.swing.JFrame(); > var button = new Packages.javax.swing.JButton("No Cheese, Gromit"); > button.addActionListener(actionListener); > frame.getContentPane().add(button); > frame.setVisible(true); > > Do I have to cast the "actionListener" (how?) before passing it to > addActionListener? Something else wrong :-)? I don't think that works with Spidermonkey, with Rhino there is JavaAdapter as explained in http://www.mozilla.org/rhino/ScriptingJava.html but I don't think anything like that is implemented in the C engine. -- Martin Honnen http://JavaScript.FAQTs.com/ .