-
Bug
-
Resolution: Fixed
-
P3
-
7u6
Its seems, that hideOnClick does only work for ContextMenus, but not for normal Menus.
Tested with 2.2 and 8.0 b84.
See also this discussion:
https://forums.oracle.com/forums/thread.jspa?messageID=10957982
In this example, the menu hides on click, although I setHideOnClick(false).
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TestApp4 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
VBox vBox = new VBox();
MenuBar menuBar = new MenuBar();
Menu menu = new Menu("test");
CustomMenuItem customMenuItem = new CustomMenuItem(new Label("test"));
customMenuItem.setHideOnClick(false);
menu.getItems().add(customMenuItem);
menuBar.getMenus().add(menu);
vBox.getChildren().add(menuBar);
Scene scene = new Scene(vBox);
stage.setScene(scene);
stage.show();
}
}
Tested with 2.2 and 8.0 b84.
See also this discussion:
https://forums.oracle.com/forums/thread.jspa?messageID=10957982
In this example, the menu hides on click, although I setHideOnClick(false).
import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class TestApp4 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(final Stage stage) throws Exception {
VBox vBox = new VBox();
MenuBar menuBar = new MenuBar();
Menu menu = new Menu("test");
CustomMenuItem customMenuItem = new CustomMenuItem(new Label("test"));
customMenuItem.setHideOnClick(false);
menu.getItems().add(customMenuItem);
menuBar.getMenus().add(menu);
vBox.getChildren().add(menuBar);
Scene scene = new Scene(vBox);
stage.setScene(scene);
stage.show();
}
}