JavaFX和MacOS鼠标
当我在应用程序中用鼠标更改窗口时,通常会崩溃,但只有在我使用OSX时,在windows中它才能正常工作,而当我使用键盘时,它也能正常工作。要更改,我使用:JavaFX和MacOS鼠标,macos,javafx,mouse,Macos,Javafx,Mouse,当我在应用程序中用鼠标更改窗口时,通常会崩溃,但只有在我使用OSX时,在windows中它才能正常工作,而当我使用键盘时,它也能正常工作。要更改,我使用: public void changeWindow(String window, String title) { Scene oldScene = menuBar.getScene(); Stage stage = (Stage) oldScene.getWindow(); Parent root; try {
public void changeWindow(String window, String title) {
Scene oldScene = menuBar.getScene();
Stage stage = (Stage) oldScene.getWindow();
Parent root;
try {
root = FXMLLoader.load(getClass().getResource(window + ".fxml"));
Scene scene;
scene = new Scene(root, oldScene.getWidth(), oldScene.getHeight());
stage.setTitle(title + " - Company Name S.L.");
stage.setScene(scene);
stage.show();
} catch (IOException e) {
System.print.out(e.getMessage());
}
}
有人能帮我吗?
-谢谢使用OS X时引发的异常是什么?这是错误。这完全是个错误。问题似乎出在java与OSX的接口代码上。不幸的是,我不知道是什么原因造成的。我现在唯一的建议就是稍微调整一下代码,看看错误是否仍然存在。尝试编写一个新窗口来显示。我已经看到,只有当我从菜单项中选择一个项目时,它才会崩溃,如果我按下一个按钮,它就会正常工作,很难说为什么会这样。您是否见过其他用户遇到类似问题?这可能表明这是程序逻辑中的一个大错误,而不是错误。