Problems with UI

Answered

Hi there,


i got very often errors like this:
WARN - tellij.ide.HackyRepaintManager - Access to realized (ever shown) UI components should be done only from the AWT event dispatch thread, revalidate(), invalidate() & repaint() is ok from any thread
java.lang.Exception

on Actions like this
subtitle.setText("");

Trivial Action, but no trivial Error or Warning... what does it mean?

0
2 comments
Official comment

It means, as it says, that you do this setText from some thread other than AWT/Swing thread, and this might lead to a deadlock or strange artifacts on the screen because of concurrency issues. The usual solution is to use SwingUtilities.invokeLater/invokeAndWait or same-named methods in ApplicationManager.getApplication().

Thank you. On Stackoverflow if found this snippet what helped:

 

    SwingUtilities.invokeLater(new Runnable() {

        @Override
        public void run() {
            // do UI actions
        }

    });
0

Please sign in to leave a comment.