我有以下问题:当我以全屏模式进入多屏幕应用程序时,我想看看哪个文本字段或按钮是聚焦的。但由于某些原因,它没有显示焦点“发光”,例如文本字段。这不是一个主要问题,而是以我想要的方式聚焦(requestFocus()完成它的工作)。
但是当我想使用来自ControlsFX(How to implement AutoComplete TextField using ControlsFX)的AutoComplete TextField Completion时,它现在变得很烦人,因为列表没有以全屏模式显示。
我将通过这些屏幕截图澄清情况:
目前处于全屏模式的方式:
它应该如何(以及非全屏模式):
要明确:问题不仅存在于AutoComplete TextField中,而且存在于每个FXML元素中。 如果我使用OSX本身的全屏模式,它以正确的方式工作(它在背景上给出错误)。但我希望应用程序以全屏模式启动。
这是我的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
}
}
如您所见,我使用的是ScreensController,它基本上是一个包含所有屏幕的StackPane。
我希望大家都清楚这个问题。
非常感谢任何帮助!
答案 0 :(得分:0)
我发现这是Java JDK 8u25中的错误。我现在已经更新到Java JDK 8u40,这解决了这个问题。此外,我已经在Windows和Linux上测试了全屏焦点,并且它也有效。因此,如果您遇到同样的问题,只需更新您的JDK。