Reputation: 475
In order to keep the app more organised, I have defined in new class for example the Frame
then the Panel
or GridBagPanel
like:
class TestGridBagPanel extends GridBagPanel { }
class TestFrame extends MainFrame {
contents = new TestGridBagPanel
reactions = new React // ??
}
class React extends WHAT?? { }
... // and so on and then called in top() method like this:
object TestApp extends SimpleSwingApplication {
def top = new TestFrame { }
}
My problem is that I am failing to know which Component to extend
in the Reaction class and I have to listen from Buttons
, TextFields
and CheckBoxes
.
Upvotes: 1
Views: 162
Reputation: 3028
Your React class should be
class React extends PartialFunction[Event,Unit]{
override def isDefinedAt(x: Event): Boolean = ...
override def apply(e: Event): Unit = e match {
case e: MouseDragged => {}
case e: MousePressed => {}
}
}
Upvotes: 1