Baptiste Clauss
Baptiste Clauss

Reputation: 91

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

Upvotes: 3

Views: 922

Answers (1)

Baptiste Clauss
Baptiste Clauss

Reputation: 91

For those that have the problem, add this parameter in the debug config:

-Dsun.awt.disablegrab=true

Upvotes: 5

Related Questions