// }
// }
// });
// title bar
final HBox titleBar = new HBox();
//titleBar.setStyle("-fx-background-color: black;");
titleBar.setPrefHeight(TOP_BORDER_HEIGHT);
titleBar.setMaxHeight(TOP_BORDER_HEIGHT);
titleBar.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent event) {
mouseDragOffsetX = event.getSceneX();
mouseDragOffsetY = event.getSceneY();
}
});
titleBar.setOnMouseDragged(new EventHandler<MouseEvent>() {
@Override public void handle(MouseEvent event) {
if (!(event.getTarget() instanceof ImageView)) {
stage.setX(event.getScreenX() - mouseDragOffsetX);
stage.setY(event.getScreenY() - mouseDragOffsetY);
}
}
});
final Region titleBarLeft = new Region();
titleBarLeft.setId("title-bar-left");
titleBarLeft.setPrefWidth(TOP_LEFT_WIDTH);
titleBarLeft.setMaxWidth(TOP_LEFT_WIDTH);
titleBarCenter = new HBox(0);
titleBarCenter.setId("title-bar");
titleBarCenter.setAlignment(Pos.TOP_LEFT);
updateTitleBarItems(titleBarItems);
HBox.setHgrow(titleBarCenter, Priority.ALWAYS);
final HBox titleBarRight = newMinMaxClose(stage);
titleBarRight.setId("title-bar-right");
titleBarRight.setPrefWidth(TOP_RIGHT_WIDTH);
titleBarRight.setMaxWidth(TOP_RIGHT_WIDTH);
//titleBarRight.getChildren().add(newMinMaxClose(stage, 0, TOP_BORDER_HEIGHT / 2 + TOP_MIN_MAX_CLOSE_Y));
titleBar.getChildren().addAll(titleBarLeft, titleBarCenter, titleBarRight);
final VBox leftBar = new VBox();
leftBar.setId("border-left");
leftBar.setPrefWidth(LEFT_BORDER_WIDTH);
leftBar.setMaxWidth(LEFT_BORDER_WIDTH);
leftBar.setTranslateX(1);
Bindings.bindBidirectional(leftBar.translateYProperty(), content.translateYProperty());
Bindings.bindBidirectional(leftBar.maxHeightProperty(), content.maxHeightProperty());
final VBox rightBar = new VBox();
rightBar.setId("border-right");
rightBar.setPrefWidth(RIGHT_BORDER_WIDTH);
rightBar.setMaxWidth(RIGHT_BORDER_WIDTH);
Bindings.bindBidirectional(rightBar.translateYProperty(), content.translateYProperty());
Bindings.bindBidirectional(rightBar.maxHeightProperty(), content.maxHeightProperty());
final HBox statusBar = new HBox();
//statusBar.setStyle("-fx-background-color: black;");
statusBar.setPrefHeight(BOTTOM_BORDER_HEIGHT);
statusBar.setMaxHeight(BOTTOM_BORDER_HEIGHT);
final Region statusBarLeft = new Region();
statusBarLeft.setId("status-bar-left");
statusBarLeft.setPrefWidth(BOTTOM_LEFT_WIDTH);
statusBarLeft.setMaxWidth(BOTTOM_LEFT_WIDTH);
final Region statusBarCenter = new Region();
statusBarCenter.setId("status-bar");
HBox.setHgrow(statusBarCenter, Priority.ALWAYS);
final HBox statusBarRight = new HBox();
statusBarRight.setAlignment(Pos.BOTTOM_RIGHT);
statusBarRight.setId("status-bar-right");
statusBarRight.setPrefWidth(BOTTOM_RIGHT_WIDTH);
statusBarRight.setMaxWidth(BOTTOM_RIGHT_WIDTH);
if (isResizable) {
final WindowReziseButton windowResizeButton = new WindowReziseButton(stage, this.getMinWidth(), this.getMinHeight());
HBox.setMargin(windowResizeButton, new Insets(BOTTOM_BORDER_HEIGHT - 11, 0, 0, 0));
statusBarRight.getChildren().addAll(windowResizeButton);
}
statusBar.getChildren().addAll(statusBarLeft, statusBarCenter, statusBarRight);
// content adjustment
stage.widthProperty().addListener(new InvalidationListener() {