Using a beanshell 'class' as an Interface (Listener)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Using a beanshell 'class' as an Interface (Listener)

Philip Cammin-2
Hi there,

first of all f i understand correctly, a scripted method can act like
a class if i put "return this" at the end.

#############################################################

This is my script, which i read in using Interpreter.source();
EKSSTANDARD() {
left(Section sect)
{
}

mouseRestsAt(Section sect)
{
}

Section secSave = new Section("Save", this);

return this;
}

#############################################################

class Section is part of my package automator3 which i program and
edit in NetBeans.
The constructor of Section:
public Section(String name, ScreenSectionMouseListener ssml)

#############################################################

interface ScreenSectionMouseListener is also part of the package automator3.
It has the methods:
public void left(Section sect)
public void mouseRestsAt(Section sect)

#############################################################




The problem is, when i do a:
Interpreter.eval("EKSSTANDARD();");
from compiled code in NetBeans, i get:
Sourced file: inline evaluation of  ``EKSSTANDARD();'' : Typed
variable declaration : Constructor error: The number of arguments was
wrong "..<insert filename>.." : new Section("Save" , this )

Called from method EKSSTANDARD : at:Line: 1 : in file: inline
evaluation of: ``EKSSTANDARD();'' : EKSSTANDARD ( )



I have looked at the JFrame JButton ActionListener actionPerformed
Example on the website over and over again but nothing. The instance
of my Section Object wants a ScreenSectionMouseListener to be passed
in his constructor but it receives a bsh.XThis Object instance. I also
tried to cast it to a ScreenSectionMouseListener but didn't work.

Any ideas?

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users