No more SwingWorker

New update version JComponentPack v3.5.6 includes two new annotation named “PlainAction” and “TaskAction”, these annotation could be used in JBean subclass or JBeanActionHandler subclass, use these annotation on the specified method, click the command on the toolbar or menubar, it’s action will invoke these method automatically.

The “PlainAction” is a plain action, it’s invoked on the Event Dispatch Thread directly when invoke, it’s name property is the action name, if the name property is not specified, use the “doXXX” method name to keep compatibility,just like set and get mark a property, the “do” prefix mark this method is a action, the “XXX” is the action name.


The “TaskAction” is a task action, it’s invoked on the background thread if it’s invoker property is false(by default), it’s result will be notified on the Event Dispatch Thread on the method “JBean.processTask(TaskResult)”, if the invoker property set to true, it will give you a chance to do something on the Event Dispatch Thread before start the task, you could popup a dialog, get the user input, then set the input to task by use “Task.setParams” method, then start the task by invoke “Task.execute” method, the task must start manually on the invoker method on the latter case.

The following is an example use the above annotation, the lambda expression come in Java 8 also work with the TaskManager, in the Java version prior to Java 8, use the TaskAction or “doXXX”  work well:

The JavaDoc API of new class include “TaskAction” and “TaskManager”  will update on the website soon.