/**
* Manage buttons and menu items
*/
public void initDecoration() {
MenuItem minimizeMenuItem = null;
// Menu
final ContextMenu contextMenu = new ContextMenu();
contextMenu.setAutoHide(true);
if (minimize != null) { // Utility Stage
minimizeMenuItem = new MenuItem(LOC.getString("Minimize"));
minimizeMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.M, KeyCombination.SHORTCUT_DOWN));
minimizeMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
switchMinimize();
}
});
contextMenu.getItems().add(minimizeMenuItem);
}
if (maximize != null && stage.isResizable()) { // Utility Stage type
maximizeMenuItem = new MenuItem(LOC.getString("Maximize"));
maximizeMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
switchMaximize();
contextMenu.hide(); // Stay stuck on screen
}
});
contextMenu.getItems().addAll(maximizeMenuItem, new SeparatorMenuItem());
}
// Fullscreen
if (stageStyle != StageStyle.UTILITY && stage.isResizable()) {
fullScreenMenuItem = new CheckMenuItem(LOC.getString("FullScreen"));
fullScreenMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
// fake
//maximizeProperty().set(!maximizeProperty().get());
switchFullscreen();
}
});
fullScreenMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.F, KeyCombination.CONTROL_DOWN, KeyCombination.SHORTCUT_DOWN));
contextMenu.getItems().addAll(fullScreenMenuItem, new SeparatorMenuItem());
}
// Close
MenuItem closeMenuItem = new MenuItem(LOC.getString("Close"));
closeMenuItem.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
switchClose();
}
});
closeMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.W, KeyCombination.SHORTCUT_DOWN));
contextMenu.getItems().add(closeMenuItem);
menu.setOnMousePressed(new EventHandler<MouseEvent>() {
@Override