I have a `SwingWorker` actor which computes a plot for display from a parameters object it gets send; then draws the plot on the EDT thread. Some GUI elements can tweak parameters for this plot. When they change I generate a new parameter object and send it to the worker.

This works so far.

Now when moving a slider many events are created and queue up in the worker's mailbox. But I only need to compute the plot for the very last set of parameters. Is there a way to drop all messages from the inbox; keep the last one and process only that?

### Currently the code looks like this

```
val worker = new SwingWorker {
  def act() {
    while (true) {
      receive {
        case params: ExperimentParameters => {
          //somehow expensive
          val result = RunExperiments.generateExperimentData(params)

          Swing.onEDT{ GuiElement.redrawWith(result) }
        }
      }
    }
  }
}

```