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

[macosx] JMenuItems in JPopupMenu are not accessible

XMLWordPrintable

    • b143
    • os_x

        Run the test listed below with either "Case 1" or "Case 2" commented.

        "Case 1", JComboBox, pops up a list which is normally accessible with VO by navigating it with arrow keys. “Case 2”, JPopupMenu, pops up the same list, but it is not accessible with arrow keys. Though, VO+"arrow key" seems to work for it.

        The problem is likely the same for Swing menus which behave like “Case 2”. Reproducible with SwingSet2.

        (The difference b/w popups is that one of it is a non-focusable window, whereas the second one is a focusable window.)

        public class Test {

            public static void main(String[] args) {
                EventQueue.invokeLater(() -> gui());
            }

            private static void gui() {
                JFrame f = new JFrame("frame");

                String[] items = { "One", "Two", "Three", "Four", "Five" };

                // case 1
                JComboBox<String> cb = new JComboBox<>(items);
                f.add(cb);

                // case 2
        // JList<String> l = new JList<>(items);
        // JPopupMenu m = new JPopupMenu();
        // m.add(l);
        // JButton b = new JButton("button");
        // b.addActionListener(e -> m.show(b, 0, 0));
        // f.add(b);

                f.pack();
                f.setLocationRelativeTo(null);
                f.setVisible(true);
            }
        }

              ptbrunet Pete Brunet (Inactive)
              ant Anton Tarasov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: