问题
Coming from a WPF world, I am having a hard time implementing some basic stuff in Java. I need to execute a *.JAR file from another java GUI application. This JAR file takes minutes to finish, and I want the GUI not to freeze.
So, my initial solution would be: create a SwingWorker class to call a command line in background.
My main concerns are:
I need to get the console output from the *.JAR file and show it in the GUI. Is it possible to update the GUI from a background thread?
Is it possible to cancel the thread from a user input?
How do I get notified that the thread is finished?
Is my solution a good one?
来源:https://stackoverflow.com/questions/22811087/implement-a-execution-log-in-java