I am currently working on a volunteer sign-in application, and need to prevent any attempts to tamper with the computer. As a start, I set the application to fullscreen, easily enough. Then I tried to set the exit key combination for the window to null, but JavaFX automatically defaults to the escape key in that case. I will have an admin section where the program can be exited using a password. Is there any way to effectively intercept any possible methods of exiting a JavaFX application's fullscreen state, or--better yet--temporarily suspend/lock other OS functions?
Edit--Using KeyCombination.NO_MATCH, I prevent the user from exiting fullscreen. However, the OS is still perfectly capable of exiting using standard key combos, or, in the case of OS X, simply by moving the mouse to the top of the screen and exiting using the program menu.
I'm i missing something? i think its cheese..
like this
primaryStage.fullScreenProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> observable,
Boolean oldValue, Boolean newValue) {
if(newValue != null && !newValue.booleanValue())
primaryStage.setFullScreen(true);
}
});
fullscreen nobody tempers till user presses the start button to obscure the UI you can prevent that though- but i will suggest try the following code only if you are about to off your pc
new Thread(new Runnable() {
@Override
public void run() {
while(true){
//in my initial try i didn't add sleep,
//and i ended up,turning off the pc,lost this post for a while
try {
Thread.sleep(100); //buy little millieseconds
} catch (InterruptedException e) {}
Platform.runLater(()->{
primaryStage.toFront();
//bring your UI on top of everyone
});
}
}
}).start();
primaryStage
is your Stage
Hope its what you want
primaryStage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH);