So I have this code
class mouseHandler implements EventHandler<MouseEvent>
{
private double sceneAnchorX;
private double sceneAnchorY;
private double anchorAngle;
private Parent parent;
private final Node nodeToMove ;
mouseHandler(Node nodeToMove)
{
this.nodeToMove = nodeToMove ;
}
@Override
public void handle(MouseEvent event)
{
else if(event.getEventType() == MouseEvent.MOUSE_CLICKED)
{
nodeToMove.requestFocus();
}
nodeToMove.setOnKeyPressed((KeyEvent)
->{
if(KeyCode.UP.equals(KeyEvent.getCode()))
{
nodeToMove.setScaleX(nodeToMove.getScaleX()+ .1);
nodeToMove.setScaleY(nodeToMove.getScaleY()+ .1);
nodeToMove.setScaleZ(nodeToMove.getScaleZ()+ .1);
System.out.println("kaw");
}
if(KeyCode.DOWN.equals(KeyEvent.getCode()))
{
nodeToMove.setScaleX(nodeToMove.getScaleX()- .1);
nodeToMove.setScaleY(nodeToMove.getScaleY()- .1);
nodeToMove.setScaleZ(nodeToMove.getScaleZ()- .1);
System.out.println("kaw");
}
});
}
}
requestFocus()
Requests that this Node get the input focus, and that this Node's top-level ancestor become the focused window.
I don't want the top level to be focused, I want my child to be. Basically I have a class that extends group and that is the node I want focus on. Instead the focus goes to the root group.
Edited by: KonradZuse on May 19, 2013 7:57 PM
Edited by: KonradZuse on May 21, 2013 9:28 PM