title: Mouse wheel not scrolling in JDialog but working in JFrame
body: <p>I'm facing a frustrating issue. I have an application where the scroll wheel doesn't work in a JDialog window (but works in a JFrame).</p>
  
  <p>Here's the code:</p>
  
  <pre><code>import javax.swing.*;
  import java.awt.event.*;
  
  public class Failtest extends JFrame {
  
   public static void main(String[] args) {
      SwingUtilities.invokeLater(new Runnable() {
         @Override
         public void run() {
            new Failtest();             
         }
      });
  
   }
  
   public Failtest() {
    super();
          setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    setTitle("FRAME");
    JScrollPane sp1 = new   JScrollPane(getNewList());
    add(sp1);
    setSize(150, 150);
          setVisible(true);
  
  
    JDialog d = new JDialog(this, false);// NOT WORKING
          //JDialog d = new JDialog((JFrame)null, false); // NOT WORKING
          //JDialog d = new JDialog((JDialog)null, false);// WORKING - WHY? 
  
    d.setTitle("DIALOG");
          d.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    JScrollPane sp = new JScrollPane(getNewList());
  
    d.add(sp);
    d.setSize(150, 150);
    d.setVisible(true);
   }
  
   public JList getNewList() {
    String objs[] = new String[30];
    for(int i=0; i&lt;objs.length; i++) {
    objs[i] = "Item "+i;
   }
   JList l = new JList(objs);
    return l;
   }
  }
  </code></pre>
  
  <p>I found a solution which is present as a comment in the java code - the constructor receiving a (JDialog)null parameter.</p>
  
  <p>Can someone enlighten me?
  My opinion is that this is a java bug.</p>
  
  <p>Tested on Windows XP-SP3 with 1 JDK and 2 JREs:</p>
  
  <pre><code>D:\Program Files\Java\jdk1.6.0_17\bin&gt;javac -version
  javac 1.6.0_17
  
  D:\Program Files\Java\jdk1.6.0_17\bin&gt;java -version
  java version "1.6.0_17"
  Java(TM) SE Runtime Environment (build 1.6.0_17-b04)
  Java HotSpot(TM) Client VM (build 14.3-b01, mixed mode, sharing)
  
  D:\Program Files\Java\jdk1.6.0_17\bin&gt;cd ..
  
  D:\Program Files\Java\jdk1.6.0_17&gt;java -version
  java version "1.6.0_18"
  Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
  Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode, sharing)
  </code></pre>
  
  <p>Thank you in advance,</p>
  
  <p>Iulian Şerbănoiu</p>
  
  <p>PS: The problem is not new - the code is taken from a forum (<a href="http://forums.sun.com/thread.jspa?threadID=723367" rel="nofollow noreferrer">here</a>) where this problem was also mentioned - but no solutions to it (yet)</p>
  
  <p><strong>LATER EDIT:</strong>
  The problem persists with jre/jdk_1.6.0_10, 1.6.0_16 also</p>
  
  <p><strong>LATER EDIT 2:</strong>
  Back home, tested on linux (Ubuntu - lucid/lynx) - both with openjdk and sun-java from distribution repo and it works (I used the .class file compiled on Windows) !!! - so I believe I'm facing a JRE bug that happens on some Windows configurations.</p>