如何从scala swing应用程序中访问类

时间:2016-06-15 22:09:30

标签: swing scala

我编写了一个swing应用程序,并希望在其中创建一个类Alignment的对象。但是当我尝试这样做时,我收到此错误消息:“无法解析符号对齐”。有人可以向我解释我做错了什么吗?

这是我的代码:

package scala.swing
package test

import event._

object Pite extends SimpleSwingApplication {
  def top = new MainFrame {
    val seq1Label = new Label("Insert First Sequence")
    val seq2Label = new Label("Insert Second Sequence")
    val seq1 = new TextArea("Input")
    val seq2 = new TextArea("Input")
    var gap = new ComboBox(List(1,2,3,4)) { makeEditable() }
    var scoringMatrix = new ComboBox(List("BLOSUM62.txt","BLOSUM50.txt","BLOSUM100.txt"))
    val button = new Button("RUN")
    val ali = new TextArea{
      text = "test"
      listenTo(button)
      reactions += {
        case ButtonClicked(`button`) =>
          val gapVal = gap.selection.item
          val seq1container = seq1.text
          val seq2container = seq2.text
          val SMcontainer = scoringMatrix.selection.item
          val proteins = new Alignment(seq1container,seq2container,gapVal,SMcontainer)
          text = proteins.aligning

      }
    }
    contents = new BoxPanel(Orientation.Vertical) { contents.append(seq1Label,seq1,seq2Label,seq2,scoringMatrix,gap,ali,button) }
  }

}

1 个答案:

答案 0 :(得分:0)

您需要导入它,因为Alignmentscala.swing中没有scala.swing.event类(但有object scala.swing.Alignment)。