JFileChooser中的滚动条给出错误 [英] Scrollbar in JFileChooser gives error

查看:94
本文介绍了JFileChooser中的滚动条给出错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用JFileChooser时,我第一次使用其滚动条时,会收到以下错误消息的两个或四个副本:

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);
    }
}

我的Swing程序继续运行(主要是),但是这困扰我。造成这种情况的原因是什么,我该如何避免呢?

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版1.8.0_66

Java(TM)SE运行时环境(版本1.8.0_66-b17)

Java HotSpot(TM)64位服务器VM(版本25.66-b17,混合模式)

用于Java开发人员的Eclipse IDE,Luna Service Release 2(4.4.2)

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)

推荐答案

这是一个封闭(不可复制)Java bug:

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

  • https://bugs.openjdk.java.net/browse/JDK-8152662

它被关闭了,因为没有提供测试用例,不是因为它不是bug。

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

这篇关于JFileChooser中的滚动条给出错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆