import scala.collection.mutable.Stackthe result is:
import scalafx.Includes._
import scalafx.collections.ObservableBuffer
import scalafx.scene.Scene
import scalafx.scene.control.{Label, ListView, TextField}
import scalafx.scene.layout.Pane
import scalafx.stage.Stage
class TableToChooseView extends Pane {
val textView = new TextField(){
promptText = "choose table for starting"
layoutX = 100
layoutY = 50
prefHeight = 30
prefWidth = 250
}
val list : List[String] = TablesDefinitionMapping.listOfAllTablesName
val characters = ObservableBuffer[String](list)
val listview = new ListView[String]{
items = characters
prefHeight =300
prefWidth = 250
layoutX = 100
layoutY = 100
}
children.addAll(listview, textView)
textView.onKeyReleased = handle {
characters.clear()
val s = list.filter( x => x.toLowerCase.contains(textView.getText.toLowerCase))
if (s .size == 0){
new Alert(AlertType.Information) {
title = "Information Dialog"
headerText = "Look, an Information Dialog"
contentText = "I have a great message for you!"
}.showAndWait()
}else {
for (i <- 0 until s.size){
characters.add(s(i))
}
}
}
listview.items = characters
listview.onMousePressed = handle {
SchemaNavigationView.listCurrentTables= List()
SchemaNavigationView.sizesChildren = Stack()
SchemaNavigationView.sizesParent = Stack()
SchemaNavigationView.listCurrentLine = List()
SchemaNavigationView.indexOfCurrentNewLine = 0
SchemaNavigationView.coordinatesOfParentTable = List()
SchemaNavigationView.indexOfChildrenTable = 0
SchemaNavigationView.indexOfParentTable = 0
new Stage {
title = "DB walker "
width = 1200
height = 600
scene = new Scene {
content = (new FirstNavigationPane(listview.getSelectionModel.getSelectedItem.toString))
}
}.show()
}
}
You are missing imports for Alert:
import scalafx.scene.control.Alert.AlertType
import scalafx.scene.control.Alert
You also need to use ScalaFX v8.0.40-R8 or newer and Java 8.0_u40 or newer.