theCanvas.setSize(new Dimension(400, 300));
theCanvas.setVisible(true);
final AwtKeyboardWrapper keyboardWrapper = new AwtKeyboardWrapper(theCanvas);
final AwtFocusWrapper focusWrapper = new AwtFocusWrapper(theCanvas);
final AwtMouseManager mouseManager = new AwtMouseManager(theCanvas);
final AwtMouseWrapper mouseWrapper = new AwtMouseWrapper(theCanvas, mouseManager);
final ControllerWrapper controllerWrapper = new DummyControllerWrapper();
final PhysicalLayer pl = new PhysicalLayer(keyboardWrapper, mouseWrapper, controllerWrapper, focusWrapper);
logicalLayer.registerInput(theCanvas, pl);
logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.H), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (source != theCanvas) {
return;
}
if (_showCursor1.get(theCanvas)) {
mouseManager.setCursor(_cursor1);
} else {
mouseManager.setCursor(_cursor2);
}
_showCursor1.put(theCanvas, !_showCursor1.get(theCanvas));
}
}));
logicalLayer.registerTrigger(new InputTrigger(new KeyPressedCondition(Key.J), new TriggerAction() {
public void perform(final Canvas source, final TwoInputStates inputStates, final double tpf) {
if (source != theCanvas) {
return;
}
mouseManager.setCursor(MouseCursor.SYSTEM_DEFAULT);
}
}));
frameWork.addCanvas(theCanvas);
frame.addComponentListener(new ComponentAdapter() {