Open and close JavaFx apps in scala console

前端 未结 1 1280
南笙
南笙 2021-01-25 08:55

Here is an example:

/*
 * Copyright 2013 ScalaFX Project
 * All right reserved.
 */
package scalafx.ensemble.example.charts

import scalafx.application.JFXApp
im         


        
相关标签:
1条回答
  • 2021-01-25 09:06

    On question 2, from a quick look at JFXApp it calls through to javafx.application.Application.launch, docs here. That page describes the life cycle, indicating that launch must only be called once. Basically JFXApp expects to be the entry point for a whole application, so shouldn't be called multiple times.

    If you want to be able to quickly relaunch your app, I would consider just running it from SBT using run or runMain rather than using the console.

    On question 1, if you do decide to run from SBT you should be able to fork in run, there are details in the SBT docs, specifically try adding fork in run := true to build.sbt.

    0 讨论(0)
提交回复
热议问题