Scrollbar in JFileChooser gives error

2019-04-08 20:18发布

When I use JFileChooser, the first time I use its scrollbar, I get two or four copies of the following error message:

2016-01-08 18:37:17.706 java[14158:2289154] inOptions: {
    JavaCUIThumbStartKey = 0;
    "is.flipped" = 0;
    kCUIOrientationKey = kCUIOrientVertical;
    kCUIThumbProportionKey = "0.497863233089447";
    max = 0;
    pressedpart = 0;
    state = normal;
    value = 0;
    widget = scrollbar;

Here is sample code that has this behavior:

package tests;
import java.awt.event.*;
import javax.swing.*;

public class SwingTest extends JFrame {

    public SwingTest() {
        JButton button = new JButton("Choose files");
        add(button);
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                chooseFile();
            }
        });
    }

    private void chooseFile() {
        JFileChooser chooser = new JFileChooser();
        chooser.showOpenDialog(this);
    }

    public static void main(String[] args) {
        SwingTest test = new SwingTest();
        test.pack();
        test.setVisible(true);
    }
}

My Swing programs continue to run (mostly), but this bothers me. What is causing this, and how can I avoid it?

Mac OS X 10.11.2 El Capitan
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
Eclipse IDE for Java Developers, Luna Service Release 2 (4.4.2)

1条回答
老娘就宠你
2楼-- · 2019-04-08 20:56

It's a Closed (Not reproductible) Java bug:

It was closed because no test case was provided, not because it is not a bug.

查看更多
登录 后发表回答