}
}
});
// Close button
close.setTooltip(new Tooltip(LOC.getString("Close")));
close.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
switchClose();
}
});
// Maximize button
// If changed via contextual menu
maximizeProperty().addListener(new ChangeListener<Boolean>() {
@Override
public void changed(ObservableValue<? extends Boolean> ov, Boolean t, Boolean t1) {
Tooltip tooltip = maximize.getTooltip();
if (tooltip.getText().equals(LOC.getString("Maximize"))) {
tooltip.setText(LOC.getString("Restore"));
maximizeMenuItem.setText(LOC.getString("Restore"));
maximize.getStyleClass().add("decoration-button-restore");
resize.setVisible(false);
} else {
tooltip.setText(LOC.getString("Maximize"));
maximizeMenuItem.setText(LOC.getString("Maximize"));
maximize.getStyleClass().remove("decoration-button-restore");
resize.setVisible(true);
}
}
});
if (maximize != null) { // Utility Stage
maximize.setTooltip(new Tooltip(LOC.getString("Maximize")));
maximize.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
switchMaximize();
}
});
}
if (fullscreen != null) { // Utility Stage
fullscreen.setTooltip(new Tooltip(LOC.getString("FullScreen")));
fullscreen.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
switchFullscreen();
}
});
}
// Minimize button
if (minimize != null) { // Utility Stage
minimize.setTooltip(new Tooltip(LOC.getString("Minimize")));
minimize.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent t) {
switchMinimize();
}