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

Nimbus L&F: MouseListener on JSplitPane divider does not produce events

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3 P3
    • None
    • 6u10
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_10-beta"
      Java(TM) SE Runtime Environment (build 1.6.0_10-beta-b25)
      Java HotSpot(TM) Client VM (build 11.0-b12, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      With Nimbus L&F (as of 6u10 build 25) it is not possible to use a MouseListener on the BasicSplitPaneDivider of a JSplitPane, the event methods never get called.
      With Windows and Metal look and feels this works as expected.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      (Compile and run the source code provided)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      mouseClicked() should get called and print "mouseClicked" when clicking (but not moving) the divider.
      ACTUAL -
      mouseClicked() never gets called, the same is true for other MouseEvents.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.awt.event.*;
      import javax.swing.*;
      import javax.swing.plaf.basic.*;

      public class DividerClickTest
      {
          public static void main(String[] args) throws Exception
          {
              UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel");

              JFrame frame = new JFrame();
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

              JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JPanel(), new JPanel());

              BasicSplitPaneDivider divider = ((BasicSplitPaneUI) splitPane.getUI()).getDivider();
              divider.addMouseListener(new MouseAdapter()
              {
                  public void mouseClicked(MouseEvent e)
                  {
                      System.out.println("mouseClicked");
                  }
              });

              frame.add(splitPane);
              frame.setSize(400, 200);
              frame.validate();
              frame.setVisible(true);
          }
      }
      ---------- END SOURCE ----------

      Release Regression From : 6u6
      The above release value was the last known release where this
      bug was not reproducible. Since then there has been a regression.

            peterz Peter Zhelezniakov
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: