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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…