public class ProgressMonitor
extends java.lang.Object
Example: AddDatasetTask task = new AddDatasetTask(datasets); ProgressMonitor pm = new ProgressMonitor(task); pm.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { if (e.getActionCommand().equals("success")) { doGoodStuff(); } } }); pm.start( this, "Add Datasets", datasets.size()); (or) AddDatasetTask task = new AddDatasetTask(datasets); ProgressMonitor pm = new ProgressMonitor(task, () -> doGoodStuff()); pm.start( this, "Add Datasets", datasets.size());
Constructor and Description |
---|
ProgressMonitor(ProgressMonitorTask task) |
ProgressMonitor(ProgressMonitorTask task,
java.awt.event.ActionListener successListener) |
Modifier and Type | Method and Description |
---|---|
void |
addActionListener(java.awt.event.ActionListener l)
Add listener: action event sent when task is done.
|
ProgressMonitorTask |
getTask() |
void |
removeActionListener(java.awt.event.ActionListener l) |
void |
start(java.awt.Component top,
java.lang.String taskName,
int progressMaxCount)
Call this from awt event thread.
|
public ProgressMonitor(ProgressMonitorTask task)
public ProgressMonitor(ProgressMonitorTask task, java.awt.event.ActionListener successListener)
public ProgressMonitorTask getTask()
public void addActionListener(java.awt.event.ActionListener l)
public void removeActionListener(java.awt.event.ActionListener l)
public void start(java.awt.Component top, java.lang.String taskName, int progressMaxCount)
top
- put ProgressMonitor on top of this component (may be null)taskName
- display name of taskprogressMaxCount
- maximum number of Progress indicator