Command and Code to send key events to GamePieces?

I’m writing some code to load up game pieces and set some properties on them.

Below is my code. Placing the model on the map and communicating to the opponent works great (the placeAt command, c1).
But I cannot figure out how to send a keycommand to the piece since the Command c2 doesn’t do anything. It should be making a number appear since selecting the model and hitting “n” on the keyboard in game makes a number (actual an image of a number) appear.

Can anybody help?

Code

GameModule mod = GameModule.getGameModule();
GamePieceCreator gamePieceCreator = GamePieceCreator.getInstance();

GamePiece piece = gamePieceCreator.getBySlotName(“piece name”);

Command c1 = GetMainMap().placeAt(piece, new Point(300, 200));
Command c2 = piece.keyEvent(KeyStroke.getKeyStroke(“n”));
c1.append(c2);
c1.execute();

Can I just ask why you are doing this in Java rather than just using the facilities built into Vassal?

Not aware of what you are referring to.

What I’m trying to do is pull a collection (army list) of GamePieces, by piece name, from a web service and load them onto a map. Versus the current need to drag and drop each piece individually.

You cant use a predefined setup?

I’d like for it to be more dynamic and configurable than saving off predefined setups.