InvokeLater - potatoscript/JavaSwing GitHub Wiki

  • We create an instance of our code example and make it visible on the screen. The invokelater() method places the application on the Swing Event Queue. It is used to ensure that all UI updates are concurrency safe. In other words, it is to prevent GUI from hanging in certain situations.
  • Class name = JdbcExample
  public static void main(String[] args){
     EventQueue.invokeLater(()->{
        JdbcExample ex = new JdbcExample();
        ex.setVisible(true);
     });
  }