Scroll menu out of control problem

Guys

I have created a scroll menu, everything seems ok except when you click on the arrows, it never stops. I tried everything but can not find which component gets the event. Any suggestion will be appreciated.

Thanks

import javax.swing.JList;

import javax.swing.JMenu;

import javax.swing.JMenuBar;

import javax.swing.JScrollPane;

import javax.swing.WindowConstants;

public class NewJFrame extends javax.swing.JFrame {

private JMenuBar menuBar;

private JMenu menu1;

public static void main(String[] args) {

NewJFrame inst = new NewJFrame();

inst.setVisible(true);

}

public NewJFrame() {

super();

initGUI();

}

private void initGUI() {

try {

setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig",

"Fish", "Horse", "Cow", "Bee", "Skunk" };

JList list = new JList(petStrings);

JScrollPane scrollPane = new JScrollPane(list);

menuBar = new JMenuBar();

setJMenuBar(menuBar);

menu1 = new JMenu();

menuBar.add(menu1);

menu1.setText("menu1");

menu1.add(scrollPane);

pack();

setSize(400, 300);

} catch (Exception e) {

e.printStackTrace();

}

}

}

[1338 byte] By [keyeventa] at [2007-11-26 22:39:54]
# 1
Works fine for me: JDK 1.6, Win 2000
ignignokt84a at 2007-7-10 11:53:19 > top of Java-index,Desktop,Core GUI APIs...
# 2
I can only use jdk1.5 instead, is that a bug of 1.5 or we need to do that in a different way?
keyeventa at 2007-7-10 11:53:19 > top of Java-index,Desktop,Core GUI APIs...
# 3
Works fine on JDK1.4.2 on XP as well.I don't know why you would be having a problem with JDK1.5. Try deleting all your .class files. Maybe you have a garbage class file lying around that is causing problems.
camickra at 2007-7-10 11:53:19 > top of Java-index,Desktop,Core GUI APIs...
# 4
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6269935This is bug is in java 1.5 and is fixed in java 1.6
Sunan.Na at 2007-7-10 11:53:19 > top of Java-index,Desktop,Core GUI APIs...