Button控件调用Cursor的枚举类型创建鼠标图标:
Button showAlertButton = new Button("Show Alert");
showAlertButton.setCursor(Cursor.WAIT);
对Scene实例调用Cursor的静态方法cursor创建鼠标图标实例:
Cursor waitCur = Cursor.cursor("WAIT")
scene.setCursor(waitCur);
?
private Stage setScreenDetails(Stage stage) {
// 获取显示屏尺寸。
Rectangle2D rectangle2D = Screen.getPrimary().getBounds();
double width = rectangle2D.getWidth();
double height = rectangle2D.getHeight();
// 设置主窗体坐标
stage.setX(width / 5);
stage.setY(height / 5);
// 设置主窗体尺寸。
stage.setWidth(width * 3 / 5);
stage.setHeight(height * 3 / 5);
stage.setResizable(true);
stage.setMinWidth(300);
stage.setMinHeight(400);
// primaryStage.setMaxWidth(width / 2);
// primaryStage.setMaxHeight(height / 2);
return stage;
}