首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Scala -扩展了MainFrame()、GridBagPanel()和“reactions”

Scala -扩展了MainFrame()、GridBagPanel()和“reactions”
EN

Stack Overflow用户
提问于 2014-11-30 12:47:44
回答 1查看 150关注 0票数 1

为了使应用程序更有条理,我在新类中定义了(例如Frame ),然后定义了PanelGridBagPanel,如:

代码语言:javascript
复制
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 { }
 }

我的问题是,在反应类中,我不知道extend的哪个组件,我必须从ButtonsTextFieldsCheckBoxes那里收听。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-11-03 11:25:52

你的反应课应该是

代码语言:javascript
复制
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 => {}
    }
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27213389

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档