Search code examples
focusfullscreenjavafx-8fxml

JavaFX8: Application in fullscreen mode doesn't show focus on elements


I have the following problem: I would like to see which textfield or button is focused when I enter my multiscreen application in fullscreen mode. But for some reason, it is not showing the focus "glow" around for example a textfield. This is not a major problem, while it is focused the way I want it (requestFocus() does its job).

But it now gets annoying when I want to use AutoComplete TextField Completion from ControlsFX (How to implement AutoComplete TextField using ControlsFX), because the list is not shown in full screen mode.

I will clarify the situation with these screenshots:

How it is now in fullscreen mode:

Current situation

How it should be (and how it is in non fullscreen):

How it should be

To be clear: the problem doesn't only exist with AutoComplete TextField, but with every FXML element. If I use the fullscreen mode from OSX itself, it works the proper way (It gives an error on the background). But I want the application to start in fullscreen mode.

This the code from my Main.java:

public class Main extends Application {

//Get the screenscontroller instance
octocash.GUI_Screens.ScreensController mainContainer = octocash.GUI_Screens.ScreensController.getInstance();
//Get the configuration instance
Configuration initApp = Configuration.getInstance();
//Create an object of Functions to establish a database connection
public static Functions databaseConnection = new Functions();
//Create a stage object to hold the primarystage
public static Stage primaryStage;

@Override
public void start(Stage stage) throws Exception {

    primaryStage = stage; //set the primary stage
    databaseConnection.DB_Connect(); //establish database connection

    //Load the initial screen (lockscreen)
    mainContainer.loadScreen(Configuration.lockScreen, Configuration.lockScreenFile);
    mainContainer.setScreen(Configuration.lockScreen);

    Group root = new Group(); //Create a group to hold all other screens
    root.getChildren().addAll(mainContainer); //Add all Screenscontroller screens to the Group
    Scene scene = new Scene(root); //set the group to the scene

    stage.getIcons().add(new Image("file:src/octocash/images/octo_cash_logo.png")); //add a menubar icon
    stage.setTitle("OctoCash Development"); //set the window name
    stage.setScene(scene); //set the scene
    stage.setFullScreen(true); //full screen without borders (no program menu bars)
    stage.setFullScreenExitHint(""); //Don't show "Press ESC to exit full screen"
    //stage.setFullScreenExitKeyCombination(KeyCombination.NO_MATCH); //DO NOT TURN ON UNLESS YOU CREATED ANOTHER METHOD TO EXIT THE PROGRAM
    stage.show(); //show the application

}

/**
 * @param args the command line arguments
 */
public static void main(String[] args) {

    launch(args); // start the application

}

}

As you can see, I am using a ScreensController, which is basically a StackPane with all of the screens in it.

I hope the question is clear to you all.

Any help is greatly appreciated!


Solution

  • I figured out that this is an error in Java JDK 8u25. I have now updated to Java JDK 8u40, and this solves the problem. Also, I have tested the fullscreen focus on Windows and Linux, and there it also works. So if you are having the same problem, just update your JDK.