Java 8 poor GUI performance compared to Java 6

前端 未结 2 1576
半阙折子戏
半阙折子戏 2021-02-03 21:09

In Java 6 below code is running as expected but in Java 8 it is taking much more time. The interesting part is that components use the same method setEnable() for e

2条回答
  •  执念已碎
    2021-02-03 21:37

    I haven't had a chance to understand exactly, but it seems like event handling might have changed in 8. Disabling the parent first speeds up the process:

    getContentPane().setEnabled(false);
    for (Component c : getContentPane().getComponents()) {
        c.setEnabled(false);
    }
    getContentPane().setEnabled(true);
    

提交回复
热议问题