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

Contextkey does not work in Nimbus

    Details

    • Subcomponent:
    • Resolved In Build:
      b60
    • CPU:
      x86
    • OS:
      solaris_2.5.1
    • Verification:
      Not verified

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.6.0_13"
        Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
        Java HotSpot(TM) Server VM (build 11.3-b02, mixed mode)

        (same error in 1.6.0_14)


        ADDITIONAL OS VERSION INFORMATION :
        Linux kurt-ubuntu 2.6.27-14-generic #1 SMP Fri Mar 13 18:00:20 UTC 2009 i686 GNU/Linux

        A DESCRIPTION OF THE PROBLEM :
        ImageMap for RootPane.ancestorInputMap is not set in Nimbus - so the Contextkey is not working.


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        try the testprogram


        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        import java.awt.Dialog.ModalityType;

        import javax.swing.JComponent;
        import javax.swing.JDialog;
        import javax.swing.JPopupMenu;
        import javax.swing.JTextArea;
        import javax.swing.SwingUtilities;
        import javax.swing.UIManager;
        import javax.swing.WindowConstants;

        import ui.UIUtils;

        import com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel;

        public class ContextMenuKeyNotWorkingInNimbus {
          public static void main(final String[] args) {

            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                try {
                  // UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
                  // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
                  // UIManager.setLookAndFeel(MetalLookAndFeel.class.getName());
                  // UIManager.setLookAndFeel(GTKLookAndFeel.class.getName());
                  UIManager.setLookAndFeel(NimbusLookAndFeel.class.getName());
                } catch (final Exception e) {
                  e.printStackTrace();
                }
              }
            });

            SwingUtilities.invokeLater(new Runnable() {
              public void run() {
                UIUtils.checkUI();
                final JPopupMenu pum = new JPopupMenu("pum");
                pum.add("first item");
                final String title = "ContextMenu-error";
                final JDialog d = new JDialog(null, title, ModalityType.DOCUMENT_MODAL);
                d.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
                final JComponent jc =
                  new JTextArea("current L&F: " + UIManager.getLookAndFeel().getName()
                    + "\nContext-Menu-Key produces no context menu in Nimbus-L&F"
                    + "\nworks fine with Metal-L&F");
                jc.setComponentPopupMenu(pum);
                d.getContentPane().add(jc);
                d.pack();
                d.setVisible(true);
              }
            });
          }
        }

        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  peterz Peter Zhelezniakov
                  Reporter:
                  ryeung Roger Yeung (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: