gaming - Key Input in javaFx 2.0 -
i working on javafx 2.0 game , want know how create when type specific key happen. give thanks taking time reading this.
make root node focused , write logic in setonkeypressed
method.
sample code:
root.setfocustraversable(true); root.setonkeypressed(new eventhandler<keyevent>() { @override public void handle(keyevent kevent) { if (kevent.getcode() == keycode.space) { system.out.println("space bar pressed"); } } });
javafx-2 gaming
No comments:
Post a Comment