2016-03-28 12 views
0

をコンパイルしない私は(ScalaFx Custom cellsから簡体字)の単純なScalaFx例からテーブルビューのコードを取りました。 ObservableBuffer 輸入scalafx.scene.Scene 輸入scalafx.scene.control {TableColumnの、テーブルビュー}単純ScalaFxテーブルビュー例

object MyTableApp extends JFXApp { 

    class Person(nameStr : String) { 
    val name = new StringProperty(this, "firstName", nameStr) 
    } 

    val characters = ObservableBuffer[Person](
    new Person("Peggy Sue"), 
    new Person("Rocky Raccoon"), 
    new Person("Bungalow Bill") 
) 

    stage = new JFXApp.PrimaryStage { 
    title = "Simple TableView" 
    scene = new Scene { 
     content = new TableView[Person](characters) { 
     columns ++= List(
      new TableColumn[Person, String] { 
      text = "First Name" 
      cellValueFactory = { _.value.name } 
      prefWidth = 100 
      } 
     ) 
     } 
    } 
    } 
} 

それをコンパイルする場合、私は混乱のエラーを取得:。

Error:(24, 11) type mismatch; 
found : scalafx.scene.control.TableColumn[MyTableApp.Person,String] 
required: javafx.scene.control.TableColumn[MyTableApp.Person, ?] 
      new TableColumn[Person, String] { 

私は間違っていますか?

マイbuild.sbtが含まれています

scalaVersion := "2.11.8" 

libraryDependencies += "org.scalafx" %% "scalafx" % "8.0.60-R9" 

答えて

1

私は慎重にサンプルソースをコピーしていなかった、と私はインポートを行方不明になった:

import scalafx.scene.control.TableColumn._