Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Dec 02 19:26

    jpsacha on master

    Correct syntax for abstract Nod… (compare)

  • Dec 02 19:25

    jpsacha on Scala3

    Correct syntax for abstract Nod… (compare)

  • Oct 14 03:24

    jpsacha on master

    Add `implicitConversions` impor… (compare)

  • Oct 14 03:23

    jpsacha on Scala3

    Add Scala-like access to `style… Remove duplicate `override` met… Update SBT to 1.3.13 and 13 more (compare)

  • Oct 13 01:57

    jpsacha on master

    WIP: add more type annotations … Upgrade to SBT 1.4.0 Upgrade ScalaTest to 3.2.2 (compare)

  • Jul 21 02:47
    jpsacha milestoned #249
  • Jul 21 02:47
    jpsacha closed #249
  • Jul 21 02:47
    jpsacha commented #249
  • Jul 18 01:12
    jpsacha closed #323
  • Jul 18 01:12
    jpsacha commented #323
  • Jul 18 01:10

    jpsacha on master

    Upgrade Scala 2.13.1 to 2.13.3 Upgrade JavaFX to 14.0.2 (compare)

  • Jul 18 00:38

    jpsacha on master

    Use prefix for JavaFX types Add a workaround for Scala 2.13… (compare)

  • Jul 17 23:29
    jpsacha closed #324
  • Jul 17 23:29
    jpsacha commented #324
  • Jul 17 23:24

    jpsacha on master

    Correct TextField demo - correc… (compare)

  • Jul 16 04:12

    jpsacha on master

    WIP: add more type annotations … Upgrade Scala 2.12 to 2.12.12 (compare)

  • Jul 15 02:43

    jpsacha on master

    Add Scala-like access to `style… Remove duplicate `override` met… Update SBT to 1.3.13 and 1 more (compare)

  • Jul 15 01:27
    jpsacha closed #329
  • Jul 15 01:27
    jpsacha commented #329
  • Jul 15 01:24
    jpsacha labeled #329
Grigory
@pomadchin
there are no commits into scala fx since oct 2017 not sure about hte status of the project

but from my experience GUI in java world is always a pain (:

but ScalaFX / JavaFX one of the best choices to do GUI in Scala / Java

Also not sure how much of the API was exposed, but i believe they are trying to port everything

Ghost
@ghost~563d4ed816b6c7089cb9c84a
Yeah, I'm really not sure how many active/in-production projects are actually using Scalafx; Really even JFX proper -- especially now that QT & Electron seems to be eating it's lunch.
The little I've played with Scalafx though, seems pretty nice/encompasing; So a bit sad.
Robin Hilliard
@robinhilliard
Thanks for that feedback Grigory/Joshua. I used to be very involved with Flex (I worked at Macromedia) and JFX seemed to leverage a lot of the same concepts. Reading around it seemed that another issue was that the newer Java versions were picking stuff up from Scala, making it less of a pain to go with JFX in Java.
nafg
@nafg
FWIW Binding.scala has a backend for jfx
Jared Engelkemier
@Jengel1

Hey everyone,

I'm still pretty new to ScalaFX but I love it so far. I'm having some trouble dynamically updating my ListView. I know the ListView constructor takes items:Seq[T] and I can pass in an Array[String] to the constructor and populate my ListView without errors. But when my application adds, modifies, or deletes a record from the Array, I'm having trouble updating the ListView. I know that ListView.items = v:ObservableBuffer[T]. But I keep getting a type mismatch error when I pass either the updated Array[String] or an ObservableBuffer[Array[String]]. Compiler wants an ObservableBuffer[Nothing]. I've searched the API, GitHub, and Stack Overflow and can't find a good solution. Any suggestions on dynamically updating my ListView? Thanks.

Romain DEP.
@rom1dep
hi there :)
jpsacha: hello!
Shovon Das
@shovoncse

How to run flash enabled webpage / that contains flash files (.swf) in JavaFX WebView?
As like browser says "Click to enable Adobe Flash Player".

When I run this link inside a WebView it does not ask to enable the flash and nothing shows inside.
http://lingkup.co.id/animasi/sirkulasi-air.html

Gonzalo Quero
@Thau

Hello, everyone! I'm having a bit of trouble using ScheduledService (bear in mind I'm a newbie in Scala, so I'm probably doing it terribly wrong). I'm trying to run a task every two ms, and for that, I'm doing this:

val svc = ScheduledService.apply(() => Task.apply(() => {
  println("Test")
}))

svc.period = Duration.apply(2)
svc.start()

But it doesn't seem to run or do anything. Can anyone guide me on what I'm doing wrong, please?

Romain DEP.
@rom1dep
@Thau
import javafx.embed.swing.JFXPanel
import scalafx.concurrent.{ScheduledService, Task}
import scalafx.util.Duration

object TinyMain extends App {
  new JFXPanel //Initializes the Toolkit

  val service = ScheduledService {
    Task {
      println("yo")
    }
  }

  service.period = new Duration(1000)
  service.start()
}
this WFM
Romain DEP.
@rom1dep
@jpsacha ping
BaghdadKh
@BaghdadKh
Hi , does scala-fx works with android and scala-js ?
Romain DEP.
@rom1dep
BaghdadKh: Hi! ScalaFX, as the name implies, is a Scala DSL for the JavaFX application framework. On android, the scala compat isn't terrific, due to android's only supporting old javas, maybe you will be able to use the fx-ports provided by gluonhq, and build a scalafx app on android using an ancient scala, but I doubt the experience will be great.
Gluon also is working on a separate JVM for android, which promises compat with newer javas (and I assume scalas), but I don't know where it's at.
JavaFX doesn't have javascript bindings, so I don't see how that would make sense to compile to JS and expect a JavaFX app in return, bit if you were to compile a JavaFX app for the web, you can have a look at jpro.one (never tried it)
Etturaz
@Etturaz
Hello. Very really newbie question: how do I use javafx themes such as bootstrapFx, gluon dark, &c. in ScalaFX?
jvr-ks
@jvr-ks

`
/*
// the file build.sbt:

scalaVersion := "2.12.9"

// https://mvnrepository.com/artifact/org.scalafx/scalafx
libraryDependencies += "org.scalafx" %% "scalafx" % "11-R16"

// https://mvnrepository.com/artifact/org.kordamp.bootstrapfx/bootstrapfx-core
libraryDependencies += "org.kordamp.bootstrapfx" % "bootstrapfx-core" % "0.2.4"

mainClass in (Compile,run) := Some("Bootstrapfx")

*/

// the file bootstrapfx.scala

import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.stage.Stage
import scalafx.scene.Scene
import scalafx.scene.layout.BorderPane
import scalafx.scene.control.Button

import org.kordamp.bootstrapfx.scene.layout._

object Bootstrapfx extends JFXApp {
stage = new PrimaryStage {
width = 800
height = 600

    scene = new Scene() {
        val button = new Button("Hello BootstrapFX")

        button.onAction = handle {
            stage.close()
        }
        button.getStyleClass().setAll("btn","btn-danger")
        root = new BorderPane() {
            center = button
        }
        stylesheets = List(getClass.getResource("org/kordamp/bootstrapfx/bootstrapfx.css").toExternalForm)
    }

}

stage.setTitle("BootstrapFX")

stage.show()

}

// to start: sbt run

`

jvr-ks
@jvr-ks
stage.show() is redundant
jvr-ks
@jvr-ks
does not run as scala-script
this runs as scala script, but not in the sbt console:
// this file bootstrapfx.scala

// jar file from https://mvnrepository.com/artifact/org.kordamp.bootstrapfx/bootstrapfx-core
// lib/bootstrapfx-core-0.2.4.jar

// jar file from https://mvnrepository.com/artifact/org.scalafx/scalafx
// lib/scalafx_2.12-12.0.2-R18.jar

// Java 8


// windows batchfile "run.bat" to run as scala-script:
/*
@rem add all *.jar in lib subdirectory to classpath

@echo off
set clp=.
for %%c in (lib/*.jar) do call :Setclasspath %%c
cmd /c scala -cp %clp% -savecompiled bootstrapfx.scala
exit /B %ERRORLEVEL%

:Setclasspath
set clp=%clp%;lib/%~1
exit /B 0

*/*/


import scalafx.Includes._
import scalafx.application.Platform
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.stage.Stage
import scalafx.scene.Scene
import scalafx.scene.layout.BorderPane
import scalafx.scene.control.Button

import java.util.concurrent
import org.kordamp.bootstrapfx.scene.layout._


val app = new JFXApp {
  def op = {
    stage = new PrimaryStage {
      width = 800
      height = 600

      scene = new Scene() {
        val button = new Button("Hello BootstrapFX")

        button.onAction = handle {
          stage.close()
          Platform.exit()
        }
        button.getStyleClass().setAll("btn", "btn-danger")
        root = new BorderPane() {
          center = button
        }
        stylesheets = List(getClass.getResource("org/kordamp/bootstrapfx/bootstrapfx.css").toExternalForm)
      }
    }
    stage.setTitle("BootstrapFX")
  }

  def onFXAndWait[R](op: => R): R = {
    if (Platform.isFxApplicationThread) {
      op
    } else {
      val callable = new concurrent.Callable[R] {
        override def call(): R = op
      }
      val future = new concurrent.FutureTask(callable)
      Platform.runLater(future)
      future.get()
    }
  }

  onFXAndWait[Unit](op)

  stage.show()
}

app.main(Array(""))
Spekular
@Spekular
Hi!
I'm getting a compilation error when I try to use Screen.getOutputScaleX ("not a member of scalafx.stage.Screen") on my desktop. However, on my laptop the code compiles fine. It looks to me like this function was introduced in Java 9, so my hunch is that for some reason my desktop is using JavaFX 8. I can't seem get sbt to build with a newer version though, and I can't even find where the old version would be installed to.

Here's my:
build.sbt (directly in the project folder)

calacOptions ++= Seq("-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8", "-feature")

// Fork a new JVM for 'run' and 'test:run', to avoid JavaFX double initialization problems
fork := true

//Allows command line version to take input
connectInput in run := true

resolvers += Resolver.sonatypeRepo("snapshots")

// Add dependency on ScalaFX library
libraryDependencies += "org.scalafx" %% "scalafx" % "12.0.2-R18"

// Determine OS version of JavaFX binaries
lazy val osName = System.getProperty("os.name") match {
  case n if n.startsWith("Linux")   => "linux"
  case n if n.startsWith("Mac")     => "mac"
  case n if n.startsWith("Windows") => "win"
  case _ => throw new Exception("Unknown platform!")
}

lazy val javaFXModules = Seq("base", "controls", "fxml", "graphics", "media", "swing", "web")
libraryDependencies ++= javaFXModules.map( m =>
  "org.openjfx" % s"javafx-$m" % "12.0.2" classifier osName
)

//Hopefully let assembly jars build?
assemblyMergeStrategy in assembly := {
 case PathList("META-INF", xs @ _*) => MergeStrategy.discard
 case x => MergeStrategy.first
}

libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.2.0"

build.properties (under "project" folder)

sbt.version=1.3.10

plugins.sbt (under "project" folder)

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
Spekular
@Spekular
I'm using sbt version 1.3.10, and the Scala version on my desktop is 2.12.7.400, but unless I'm mistaken sbt should grab a version that matches it's own?
Laptop has no standalone Scala install and is on sbt version 1.2.8
However, since the project is synced between the two sbt.version=1.3.10 should apply there as well.
Spekular
@Spekular
Fixed, there were some remnants of Java 1.8 that I had to delete to get it to use 1.12 (deleted the entire C:\Program Files (x86)\Common Data\Oracle\Java folder)
DavidGoodenough
@DavidGoodenough
Is there a way with fx-9+ to build all three os versions with sbt in one run, and name the results to include the os name?
Will Paul
@dropofwill
Anyone manage to get scalafx building a graal native-image? I've been playing Gluon's substrate which works fine for Java, but haven't been able to get it to work with classes from Scala.
Daniele Tentoni
@Daniele-Tentoni
Hi all I'm a student from Italy and pretty new to Scala development, what library you use to test scalafx applications?
Romain DEP.
@rom1dep
@dropofwill hi! FYI there's been a new release of graalvm/native-image, maybe you'll get more luck with it?
Leon Burdinov
@leonbur

Hello everyone. I'm trying to use SBT's ~run to reload changes to the code but it doens't work in ScalaFX projects. even the basic example from Scala Tutorials doesn't work and it has fork := true in build.sbt

did you encounter this?

Rohan Sircar
@rohan-sircar
@leonbur you can try DCEVM instead for hot code reload in JVM apps.
Leon Burdinov
@leonbur
@rohan-sircar I will but do you have any idea why SBT fails on this?
Rohan Sircar
@rohan-sircar
@leonbur Unfortunately not. I'd need more detail/to look at the error at the very least.
Leon Burdinov
@leonbur
there is no error though. here's an example of the simplest project: https://github.com/scalafx/ScalaFX-Tutorials/tree/master/hello-sbt
if you can please run with SBT and see for yourself
if I change the code and save, it's only when I close the first instance of the application that SBT loads right away a new instance with the changes
it really felt like fork := true would solve this. it looks just like that behaviour
Rohan Sircar
@rohan-sircar
Yeah I expected that, I've had that happen with a spring boot + javafx project as well, it's not an sbt specific issue. It's probably because javafx blocks the "application" preventing sbt from restarting it.
Like, it also happens when I run ammonite in sbt ~console. The console reloads only when I exit ammonite.
As I said, at least as far as GUI's are concerned DCEVM is the way to go.
Leon Burdinov
@leonbur
@rohan-sircar I see. thank you very much!
Rohan Sircar
@rohan-sircar
As a bonus, for best results -
1) Download DCEVM from here https://github.com/TravaOpenJDK/trava-jdk-11-dcevm/releases
2) Start Intellij and your app with that JVM
3) Run your app in intellij in debug mode
Leon Burdinov
@leonbur
thanks! I was starting looking at intelliJ plugins
for DCEVM