JFXApp3

trait JFXApp3

ScalaFX applications can extend JFXApp3 to create properly initialized JavaFX applications.

ScalaFX applications can extend JFXApp3 to create properly initialized JavaFX applications.

On the back end JFXApp3 first calls javafx.application.Application.launch then executes body of its constructor when javafx.application.Application.start(primaryStage:Stage) is called. Here is an example use:

 object SimpleScalaFXApp extends JFXApp3 {
   override def start() : Unit = {
     stage = new PrimaryStage {
       title = "Simple ScalaFX App"
       scene = new Scene {
         root = new StackPane {
           padding = Insets(20)
           content = new Rectangle {
             width = 200
             height = 200
             fill = Color.DEEPSKYBLUE
           }
         }
       }
     }
   }
 }
Companion
object
class Object
trait Matchable
class Any

Value members

Abstract methods

def start(): Unit

The main application method. Executed on JavaFX Application thread.

The main application method. Executed on JavaFX Application thread.

Concrete methods

def main(args: Array[String]): Unit

Perform app-related initialization, and execute initialization/construction code for all classes and objects that extend this trait.

Perform app-related initialization, and execute initialization/construction code for all classes and objects that extend this trait.

Value Params
args

Command line arguments.

Note

You are strongly advised not to override this function.

def stopApp(): Unit

This method is called when the application should stop, and provides a convenient place to prepare for application exit and destroy resources.

This method is called when the application should stop, and provides a convenient place to prepare for application exit and destroy resources.

It is called from javafx.Application.stop method. The implementation of this method provided by the JFXApp3 class does nothing.

NOTE: This method is called on the JavaFX Application Thread, the same as javafx.Application.stop method.

Concrete fields

JFXApp3 stage must be an instance of scalafx.application.JFXApp3.PrimaryStage to ensure that it actually is a proper wrapper for the primary stage supplied by JavaFX.

JFXApp3 stage must be an instance of scalafx.application.JFXApp3.PrimaryStage to ensure that it actually is a proper wrapper for the primary stage supplied by JavaFX.