Hi all,
I am not sure whether to post this in VB or Java but since I suspect it might be my Java Bean that is wrong, I post here

I am trying to make a Java Bean which fires events (custom made), whenever its setter is called. It has an integer property. In the O'reilly book "Developing Java Beans" it claims that by converting the Bean into an ActiveX control and placing inside a container such as a VB form, then if that Bean fires event, VB should recognised this and be able to produce skeleton code to handle the events... as long as design patterns are followed, reflection should realise this. For Properties, reflection is spot on. But for Events... I am not sure what I'm doing wrong.
I place the ActiveX control of my bean into a form, but according to Visual Studios Object browser, it does not recognise my Bean as a source of my custom made events and so cant generate skeletion code.
On a seperate experiment I made the bean only register one listener and throw a TooManyListenerException should any more wish to listen to my bean. According the the O'reilly book, the VB container should be able to see the add listener method in my bean used to register listeners and the container will automatically register itself, which it does (i tried adding another listener in Visual Studio and got the exception)... but it just doesnt know what events come from the bean...

I'm at a complete loss as to what I am doing wrong, or whether it's possible (O'reilly book is old.. but so far it's been correct)
my code is below. Please note, that in the manifest file of my jar, only the MyBean class is registered as a bean and only these methods can be accessed.

I'd apprectiate any help or assistance in this long problem I've been having. thank you

Code:
import java.util.EventObject;
//THE EVENT OBJECT

public class CommandReceivedEvent extends EventObject{

	private int command;
	public CommandReceivedEvent(Object source, int command)
	{
		super(source);
		this.command=command;
	}
	
	public int getCommand()
	{
		return this.command;
	}
	
}

//-------------------------seperate java file

import java.util.*;
//LISTENER INTERFACE

public interface CommandReceivedListener extends EventListener{

	
	//this means MyBean's setCommand was called and a new value set... 
	//now that value is wrapped in the event so the listner has access to that 
	//value via the event and sets its own command variable to match
	public void CommandReceived(CommandReceivedEvent evt);
}

//-------------------------seperate java file

//THE LISTENER
public class ListeningCommand implements CommandReceivedListener{
	private int command=0;
	
	public ListeningCommand()
	{
		
	}
	
	public void setCommand(int c)
	{
		this.command=c;
	}
	
	public int getCommand()
	{
		return this.command;
	}
	
//	this means MyBean's setCommand was called and a new value set... 
	//now that value is wrapped in the event so the listner has access to that 
	//value via the event and sets its own command variable to match
	public void CommandReceived(CommandReceivedEvent evt)
	{
//		DEBUG
		System.out.println("Received Event... "+ evt.getCommand());
		int i=evt.getCommand();
		this.setCommand(i);
//		DEBUG
		System.out.println("inside event handler...value set as "+getCommand());
	}
	

}

//-------------------------seperate java file

import java.util.*;
/*
 * Created on 12-Feb-2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
//THE BEAN:  SOURCE OF EVENT

public class MyBean {
	private int command= 0;
	private ListeningCommand listener=new ListeningCommand();
	public MyBean()
	{
		
	}
	
	public void setCommand(int n)
	{
		this.command=n;
		updateListener();
	}
	
	public int getCommand()
	{
		return this.command;
	}
	
	public synchronized void addListeningCommandListener(ListeningCommand l) 
	throws TooManyListenersException
	{
		if(listener!=null)
		{
			throw new TooManyListenersException();
		}
		listener=l;
	}
	
	public synchronized void removeListeningCommandListener(ListeningCommand l)
	{
		if(listener==l)
		{
			listener=null;
		}
	}
	
	public void updateListener()
	{
		//DEBUG
		System.out.println("creating new event "+this.getCommand());
		CommandReceivedEvent evt= new CommandReceivedEvent(this, this.getCommand());
//		DEBUG
		System.out.println("sending event to listener");
		listener.CommandReceived(evt);
	}
}