Skip to content

A work-in-progress implementation of scalapfui for JavaFX.

Notifications You must be signed in to change notification settings

bertderbecker/scalapfui-javafx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

scalapfui-javafx

A sample implementation of scalapfui for some concepts of JavaFX.

Here's an example:

object Test extends JFXApp {

  val textFieldText: FXStoredAttribute[String] = FXStoredAttribute("enter")
  val stageWidth: StoredReadableAttribute[Double] = FXStoredReadableAttribute[Double]()
  val stageHeight: StoredReadableAttribute[Double] = FXStoredReadableAttribute[Double]()

  def buildLayout(x: Int): FXParent[JFXVBox] =
    VBox(
      MenuBar(
        Menu(
          MenuItem(
            menuItem.text := "" + x + " Actions",
            menuItem.onAction := rebuild(_ => buildLayout(x + 1))
          )
        )(
          menu.text := "Menu"
        )
      )(
        menuBar.prefWidth <== menuBar.layoutX
      ),
      TextField(
        textField.text := "" + x + " Actions",
        textField.text ==> textFieldText,
        textField.onAction := modify(textFieldText := "entered !!"),
        textField.onMouseReleased := EventReactor.rebuild(_ => buildLayout(x - 1))
      )
    )()

  primaryStage =
    Stage(
      stage.title := "Hello World !!!",
      stage.width ==> stageWidth,
      stage.height ==> stageHeight,
      stage.scene := Scene(
        buildLayout(0)
      )()
    )
}

Another example is the sample implementation of Connect4.

About

A work-in-progress implementation of scalapfui for JavaFX.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages