Java Code Examples for javax.swing.SwingWorker#addPropertyChangeListener()

The following examples show how to use javax.swing.SwingWorker#addPropertyChangeListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThreadManager.java    From MtgDesktopCompanion with GNU General Public License v3.0 6 votes vote down vote up
public void runInEdt(SwingWorker<?, ?> runnable,String name) {
	runnable.execute();
	Chrono c = new Chrono();
	
	runnable.addPropertyChangeListener((PropertyChangeEvent ev)->{
		if(ev.getNewValue().toString().equals("STARTED"))
		{ 
			c.start();
			logger.trace(name+"\t"+ev.getSource()+"\t STARTED");
		}
		
		if(ev.getNewValue().toString().equals("DONE"))
			logger.trace(name+"\t"+ev.getSource().getClass().getName()+"\t FINISHED IN "+c.stopInMillisecond()+"ms.");
		
	});
}
 
Example 2
Source File: CachingSwingWorker.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void blockSwingWithProgressDialog(final SwingWorker<T, Object> localWorker) {
	if (!localWorker.isDone()) {

		TaskDialog dialog = new SwingWorkerTaskDialog(name, hasProgress, localWorker);
		taskMonitor.setBlockingMonitor(dialog);
		localWorker.addPropertyChangeListener(new SwingWorkerCompletionWaiter(dialog));
		dialog.show(taskDialogDelay);
	}
}
 
Example 3
Source File: SwingWorkerBasedComponentVisibility.java    From blog with Apache License 2.0 4 votes vote down vote up
public void attachPropertyChangeListener(SwingWorker<?, ?> swingWorker) {
	swingWorker.addPropertyChangeListener(swingWorkerPropertyChangeAdapter);
}
 
Example 4
Source File: SwingWorkerProgressModel.java    From blog with Apache License 2.0 4 votes vote down vote up
/**
 * @inherited
 */
@Override
public void attachPropertyChangeListener(SwingWorker<?, ?> swingWorker) {
	swingWorker.addPropertyChangeListener(swingWorkerAdapter);
}