Using a beanshell 'class' as an Interface (Listener)
Philip Cammin <[email protected]> Thu, 19 Feb 2009 14:57:44 +0100
| Newsgroups | gmane.comp.java.beanshell.user |
|---|---|
| Message-ID | <[email protected]> |
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