Swing Scala-扩展MainFrame()、GridBagPanel()和';反应';
为了使应用程序更有条理,我在新类中定义了Swing Scala-扩展MainFrame()、GridBagPanel()和';反应';,swing,scala,Swing,Scala,为了使应用程序更有条理,我在新类中定义了框架,然后是面板或GridBagPanel,例如: class TestGridBagPanel extends GridBagPanel { } class TestFrame extends MainFrame { contents = new TestGridBagPanel reactions = new React // ?? } class React extends WHAT?? { } ... // and so on a
框架
,然后是面板
或GridBagPanel
,例如:
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 { }
}
我的问题是,我不知道要在Reaction类中扩展哪个组件,我必须从
按钮
、文本字段和复选框
中收听React类应该是什么
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 => {}
}
}