Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8227679

First option in the context menu is highlighted without hovering the mouse from

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • jfx11, jfx13, 8u60, 9, jfx14
    • javafx
    • 9
    • x86_64
    • windows_10

      ADDITIONAL SYSTEM INFORMATION :
      Windows

      A DESCRIPTION OF THE PROBLEM :
      when we right click for context menu, the first option in the list is being highlighted without hovering the mouse. This happens only for the first time right click after the application is opened. This behavior is observed from javafx-9. Till javafx-8 its working fine.

      REGRESSION : Last worked in version 8u212

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      try with the below code:

          import javafx.application.Application;
          import javafx.scene.Scene;
          import javafx.scene.control.ContextMenu;
          import javafx.scene.control.Label;
          import javafx.scene.control.MenuItem;
          import javafx.scene.layout.TilePane;
          import javafx.stage.Stage;
          
          public class SampleContextMenu extends Application {
              // labels
              Label l;
          
              public static void main(String args[]) {
                  // launch the application
                  launch(args);
              }
          
              // launch the application
              public void start(Stage stage) {
                  // set title for the stage
                  stage.setTitle("creating contextMenu ");
          
                  // create a label
                  Label label1 = new Label("This is a ContextMenu example ");
          
                  // create a menu
                  ContextMenu contextMenu = new ContextMenu();
          
                  // create menuitems
                  MenuItem menuItem1 = new MenuItem("menu item 1");
                  MenuItem menuItem2 = new MenuItem("menu item 2");
                  MenuItem menuItem3 = new MenuItem("menu item 3");
          
                  // add menu items to menu
                  contextMenu.getItems().add(menuItem1);
                  contextMenu.getItems().add(menuItem2);
                  contextMenu.getItems().add(menuItem3);
          
                  // create a tilepane
                  TilePane tilePane = new TilePane(label1);
          
                  // setContextMenu to label
                  label1.setContextMenu(contextMenu);
          
                  // create a scene
                  Scene sc = new Scene(tilePane, 200, 200);
          
                  // set the scene
                  stage.setScene(sc);
          
                  stage.show();
              }
          }


      FREQUENCY : always


            aghaisas Ajit Ghaisas
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: