var nClicks = 0; reactions += { case ButtonClicked(b) => nClicks += 1 label.text = "Number of clicks: " + nClicks }
OK, fine.
Now I make a new component: var vc = new VertexComponent
Where (in another file):
import scala.swing.Component import scala.swing._
class VertexComponent extends Component {
override def paint(g: Graphics2D):Unit = {
//... blah. This works. }
}
I want to know how I trap a button click on the component. Do I need to set up my own case class like ButtonClick? How do I tie that to the actual event?