The missing SwingApplication class in Java Swing Framework.

越俊艾
2023-12-01
import javax.swing.SwingUtilities;

/**
 * The missing SwingApplication class in Java Swing Framework.
 *
 * @author raistlic
 */
public abstract class SwingApplication {
  
  public abstract void runLater() throws Exception;
  
  public abstract void handleException(Throwable t);
  
  public final void execute() {
    
    SwingUtilities.invokeLater(new Runnable() {

      @Override
      public void run() {
        
        try {
          
          runLater();
        }
        catch(Throwable t) {
          
          handleException(t);
        }
      }
    });
  }
}

 类似资料:

相关阅读

相关文章

相关问答