Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 681429
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T01:28:57+00:00 2026-05-14T01:28:57+00:00

I’m facing a frustrating issue. I have an application where the scroll wheel doesn’t

  • 0

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).

Here’s the 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<objs.length; i++) {
  objs[i] = "Item "+i;
 }
 JList l = new JList(objs);
  return l;
 }
}

I found a solution which is present as a comment in the java code – the constructor receiving a (JDialog)null parameter.

Can someone enlighten me?
My opinion is that this is a java bug.

Tested on Windows XP-SP3 with 1 JDK and 2 JREs:

D:\Program Files\Java\jdk1.6.0_17\bin>javac -version
javac 1.6.0_17

D:\Program Files\Java\jdk1.6.0_17\bin>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>cd ..

D:\Program Files\Java\jdk1.6.0_17>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)

Thank you in advance,

Iulian Şerbănoiu

PS: The problem is not new – the code is taken from a forum (here) where this problem was also mentioned – but no solutions to it (yet)

LATER EDIT:
The problem persists with jre/jdk_1.6.0_10, 1.6.0_16 also

LATER EDIT 2:
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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T01:28:58+00:00Added an answer on May 14, 2026 at 1:28 am

    There is something weird with your java install : your default version is not the 1.6.0_17 you show us, but an even more recent 1.6.0_18.

    Anyway, using my (just a little older) 1.6.0_16 version on Windows XP, I cannot reproduce your issue, letting me think it may be a bug in J

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.