简体   繁体   中英

Debugging Java Swing App causes computer freeze

I'm developing a Java/Swing Desktop app on XUbuntu using Eclipse2018-12. I'm facing a problem when debugging. When Eclipse reaches a breakpoint in the addItemListener event of a JComboBox , all freezes, including the computer...

I thought it was linked to the Java installation and the debug configuration, so I tried by changing the version of the JRE used but nothing changed.

Here is the code of the

JComboBox<ComboItem> res = new JComboBox<ComboItem>();
        res.addItemListener(new ItemListener() {
            @Override
            public void itemStateChanged(ItemEvent event) {
                if (event.getStateChange() == ItemEvent.SELECTED && peopleCombo != null) {
                                           //do things
                    }
                }
            }    
        });
        return res; 

Here is the java version.

java --version
openjdk 11.0.2 2019-01-15
OpenJDK Runtime Environment (build 11.0.2+9-Ubuntu-3ubuntu118.04.3)
OpenJDK 64-Bit Server VM (build 11.0.2+9-Ubuntu-3ubuntu118.04.3, mixed mode, sharing)

Should I change this event ? Or the java version used ?

Thanks for your help,

Baptiste

对于那些有问题的人,请在调试配置中添加此参数:

-Dsun.awt.disablegrab=true

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM