This question is in reference to Java-Swing-0.02. The author, Philip Crow suggested addressing questions to this list which he monitors. OK, here goes:

In general things are set up and work very nicely. Thanks!
But I need to create a Timer object. I tried this:

my $timer = Timer->new(1000,\&myTimerListener);

with the following listener:

sub myTimerListener {
  my $generating_object = shift;
  my $event             = shift;
  print "Hello, Timer!\n";
}


When I try to run, I get this:

Can't convert CODE(0x52b3b0) to object java.awt.event.ActionListener at /usr/lib/perl5/site_perl/5.8.5/Inline/Java/Object.pm line 101

I understand the method whereby I might do something like this:

$swinger->connect( 'ActionListener', $timer, { actionPerformed => \&myTimerListener });

But that implies I have a Timer object and I just can't create one because the constructor demands a timeout and an ActionListener reference for the constructor. In a nutshell, I don't know how to "cast" myTimerListener to an OBJECT reference as opposed to a CODE reference. At least I think that's my problem.

Thanks for listening,

Mike

Reply via email to