For example, I am using javaFx scene and I add a plane object and then add the group with required missle images and then add scene. Now when I add an event filter on the scene of moving a missle then remove it just after, the scene still responds to keyboard presses in moveMissle() event filters when it runs. Also, if you add event filters it does not yet does not remove them using the remvoveEventFilter method. Shouldn't it remove it because I coded to remove the event Filter so it does not respond to any keys? Thank you.
public class Main extends Application
{
@Override
public void start(Stage primaryStage)
{
Plane plane = new Plane();
Group group = new Group(plane.getPlaneImage(), plane.getMissleZero().getMissleImage(), plane.getMissleOne().getMissleImage(), plane.geMissleTwo().getMissleImage(), plane.getMissleThree().getMissleImage(), plane.getMissleFour().getMissleImage());
Scene scene = new Scene(group, 700, 700);
scene.setFill(Color.BLACK);
scene.addEventFilter(KeyEvent.KEY_PRESSED, plane.getMissleZero().moveMissle());
scene.removeEventFilter(KeyEvent.KEY_PRESSED, plane.getMissleZero().moveMissle());
primaryStage.setScene(scene);
primaryStage.show();
}
}