Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jun 08 03:05

    jpsacha on master

    WIP #256: Deal with null argume… WIP #256: CellFactory for Table… (compare)

  • Jun 08 01:42

    jpsacha on master

    Update SBT to 1.5.3 Update Scala 2.12 WIP #256: CellFactory for TreeV… and 2 more (compare)

  • Jun 08 01:32
    jpsacha opened #357
  • Jun 08 01:32
    jpsacha milestoned #357
  • Jun 08 01:32
    jpsacha labeled #357
  • Jun 08 01:27
    jpsacha commented #352
  • Jun 02 02:25
    jpsacha commented #356
  • Jun 02 02:24
    jpsacha closed #356
  • May 27 21:58
    rom1dep synchronize #356
  • May 27 21:49
    rom1dep commented #356
  • May 27 00:10
    jpsacha commented #356
  • May 24 22:02
    rom1dep commented #352
  • May 24 21:45
    rom1dep opened #356
  • May 20 01:46

    jpsacha on master

    WIP #256: Add ScalaDoc to 'Comb… WIP #256: Add color preview to … WIP #256: CellFactory for ListV… and 2 more (compare)

  • May 19 01:56

    jpsacha on master

    Update Scala 2.13 to 2.13.6 (compare)

  • May 19 01:50

    jpsacha on master

    WIP #256: CellFactory for Combo… (compare)

  • May 19 01:49
    jpsacha milestoned #256
  • May 19 01:49
    jpsacha demilestoned #256
  • May 18 19:35
    jpsacha commented #352
  • May 18 15:35
    rom1dep commented #352
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?
Joerg von Roos
@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

`

Joerg von Roos
@jvr-ks
stage.show() is redundant
Joerg von Roos
@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
Romain DEP.
@rom1dep
scalafx is so much more pleasing to read with Scala 3's braceless syntax
Rohan Sircar
@rohan-sircar
Wait, it's updated to scala 3 already?
Romain DEP.
@rom1dep
image.png
well… :)
quite happy that my codebase built against scala3 with only minor changes
Rohan Sircar
@rohan-sircar
damn, gotta try it asap
Romain DEP.
@rom1dep
I also don't miss putting new everywhere