https://kotlinlang.org logo
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
tornadofx
  • t

    Tim McCormack

    12/08/2019, 2:17 PM
    Hmm,
    confirm
    suffers the same problem as creating a JavaFX dialog directly: The text gets cut off and you can't even resize the alert window to see the truncated message.
    a
    • 2
    • 3
  • t

    Tim McCormack

    12/08/2019, 2:19 PM
    confirm(
        title = "Delete post?",
        header = "Delete this post?",
        content = "The entire post and all of its attachments will be deleted irrevocably.",
        actionFn = {
            println("DELETING")
        }
    )
    a
    • 2
    • 4
  • t

    Tim McCormack

    12/08/2019, 2:19 PM
    I'm really losing patience with JavaFX. -.-
    a
    • 2
    • 2
  • t

    Tim McCormack

    12/08/2019, 2:21 PM
    Are there other cross-platform UI toolkits I should investigate, or is JavaFX the main game in town?
    a
    • 2
    • 9
  • t

    Tim McCormack

    12/12/2019, 1:40 AM
    How do I get text to wrap to the width of the container? I have an HBox that centers a VBox, and the VBox is nicely elastic: It's the full width of the window when the window is small, but expands wider (to a limit) as the window is enlarged. But if I stick a Text with a paragraph of text into that VBox, it overflows and just keeps on going, off-screen, as a single line. I can set a wrapping width, but that ignores the size of the VBox container, which ruins the elastic UI.
    • 1
    • 3
  • a

    albrechtroehm

    12/13/2019, 3:09 PM
    Hey everyone, can someone help me to find a nice way to go from one view (MainMenu) to the next view (Workspace). They have different size which makes everything using
    mainmenu.replaceWith(workspace, sizeToScenne = true, ...)
    kind of ugly, lagy or jumpy... on the other hand creating a new Window with
    find<WorkspaceView>().close()
    find<MainMenu>().openWindow(escapeClosesWindow = false)
    resulted in messing up the scopes (which i didn't cared about at all at that point) and some other stuff... but looks much better. Maybe someone has some thoughts on this ... Thanks
    • 1
    • 1
  • m

    Mr.NiceGuy

    12/15/2019, 4:43 PM
    Hi everyone, Any idea why this is happening when I am trying to run TornadoFX application via intellij (with Gradle) but if I am compiling the project into far-jar it's running without any issue.
    ✅ 1
    • 1
    • 1
  • l

    LastExceed

    12/16/2019, 1:53 PM
    i made a tornadofx with jdk11 project that worked fine until yesterday, but today: when using jdk8 it highlights all javafx imports as unresolved references when using jdk11 it doesnt highlight anything, but i still get "unresolved reference" compile errors when using jdk13 i get a groovy script error even though i use a kotlinscript instead of groovy for my build.gradle wtf is going on (╯°□°)╯︵ ┻━┻
    c
    • 2
    • 2
  • l

    LastExceed

    12/17/2019, 1:46 PM
    listview(blocks) {
    	setCellFactory {
    		val cell = ListCell<Block>()
    		cell.text = cell.item.toString() //nullref here because cell.item is null
    		return@setCellFactory cell
    	}
    }
    how do i get a reference to the item the cell is going to represent so I can set the cell text?
    r
    • 2
    • 2
  • s

    sbyrne

    12/17/2019, 2:06 PM
    It seems that you're better off having everything you need in the column value so you can use
    TableCell.itemProperty()
    .
    l
    • 2
    • 1
  • s

    sbyrne

    12/17/2019, 2:09 PM
    Have you already tried to do what you want with cellFormat?
    l
    • 2
    • 5
  • d

    Douglas KN

    12/19/2019, 3:14 AM
    I've been using tornadofx with jdk11 using a gradle build and suddenly yesterday it stopped being able to run the app in intellij or with
    gradle run
    . That seemed like a bug in the javafx gradle plugin -- the error message was because it was running with
    --module-path
    that had no arguments. I managed to solve it by downloading openjfx 11 and setting
    sdk =  'javafx-sdk-11.0.2'
    . Now I can build and run the app both directly via gradle and in intellij. HOWEVER, now intellij is red-underlining all javafx references because it can't find the library. How do I tell intellij where to find the javafx library so that I don't get the underlines and code completion starts working again?
    • 1
    • 1
  • s

    sbyrne

    12/19/2019, 6:36 PM
    Does TornadoFX on Jdk11 work as well as on Jdk8, or are there runtime issues?
    a
    • 2
    • 4
  • t

    Tim McCormack

    12/25/2019, 3:18 PM
    Oh good, javafx 14-ea+6 fixes the problem where a single emoji can crash the entire application.
    a
    • 2
    • 2
  • a

    albrechtroehm

    12/26/2019, 12:03 PM
    Hey everyone, could someone post a example gradle-build file how to wire a newer jdk 11+, jfx-plugin, tfx and so on. Somehow i cant get it right. Thanks!
    ➕ 1
    m
    a
    • 3
    • 7
  • s

    sbyrne

    12/30/2019, 8:30 PM
    If I have a vbox with 2 children, is there a way to force it so the two children each take up 50% of the height?
    r
    c
    • 3
    • 4
  • g

    groostav

    01/03/2020, 12:02 AM
    one thing I've always liked the idea of is dictionaries keyed by type, that return typed values. Coroutines implemented this with coroutine scope, where you can write
    coroutineScope[Job]
    and the static type of the return expression is
    Job
    . Similarly the static type of
    coroutineScope[Dispatcher]
    is
    Dispatcher
    . I'm looking at
    Node.properties: Map<Object, Object>
    and wishing it was something similar to
    CoroutineContext
    . Ideally I could write something like
    myNode.typedProps[ImportantListener]...
    Has anybody implemented this?
    r
    • 2
    • 1
  • s

    sbyrne

    01/03/2020, 7:42 PM
    I have a object in a 3rd party library (e.g.:
    Person
    ) that I am using as the value of an
    ItemViewModel
    . It has a collection (e.g.:
    var hairColors:Set<String>
    ). How do I bind it to the
    ItemViewModel
    ? If I do
    val hairColors = bind(Person::hairColors)
    , I get
    java.lang.ClassCastException: java.util.LinkedHashSet cannot be cast to javafx.collections.ObservableSet
    . I think I need to do something with
    bind(forceObjectProperty=true)
    and
    rebindOnChange
    , but I am not sure what.
    • 1
    • 1
  • n

    Ngenge Senior

    01/04/2020, 8:01 AM
    I cannot really understand why this is the case. I have installed
    JDK 13
    and
    Open JFX
    but when I create a tornadofx project using IntelliJ plugin, it keeps failing.
    a
    r
    +2
    • 5
    • 10
  • h

    Hullaballoonatic

    01/06/2020, 3:30 AM
    I'm really surprised there is no parameter or method to set the stage title in
    App
    , nor to provide multiple stage icons. Also why must we provide the entire
    Image
    instead of the filepath and let the
    App
    class handle the rest? Also no stage dimensions...
    class Start : App(
        title = "My App", 
        height = 300.0, width = 600.0,
        primaryView = MainView::class,
        icons = arrayOf("myIconS.png", "myIconM.png", "myIconL.png"),
        stylesheets = arrayOf(MyStyleSheet1::class, MyStyleSheet2::class)
    )
    b
    • 2
    • 2
  • c

    carlw

    01/07/2020, 6:24 PM
    Hi. Not directly related to TornadoFX, but there's a Log4j exploit out and you may need to upgrade. https://github.com/advisories/GHSA-2qrg-x229-3v8q
    r
    • 2
    • 3
  • b

    bjonnh

    01/08/2020, 11:30 PM
    well 73M that would fit on a zip drive 😆
    a
    • 2
    • 72
  • t

    thomasnield

    01/10/2020, 10:29 PM
    I've gotten rusty on my JavaFX/TornadoFX animation. I'm creating a demo for a symposium I'm speaking at, showing machine learning versus rule-based algorithms with autonomous vehicles. I am creating a VERY simple simulation where a little triangle has three sensor lines sticking out of it, and it's going to follow a path and avoid hitting any walls that touch those sensors. Here is what I have so far: https://github.com/thomasnield/auto-driving-simulation
    a
    • 2
    • 3
  • t

    thomasnield

    01/10/2020, 10:30 PM
    My simple question is... what is the easiest way to animate it following a path, while rotating so its nose follows the path?
    r
    • 2
    • 2
  • g

    GarouDan

    01/11/2020, 2:46 PM
    Does someone know how to solve this problem?
    e: Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
        class tornadofx.UIComponent, unresolved supertypes: javafx.event.EventTarget
        class <http://tornadofx.App|tornadofx.App>, unresolved supertypes: javafx.application.Application
    For now I’d prefer to rely on Java 8 (because of some other modules of mine), my current Java configuration is:
    openjdk version "1.8.0_232"
    OpenJDK Runtime Environment (Zulu 8.42.0.23-CA-macosx) (build 1.8.0_232-b18)
    OpenJDK 64-Bit Server VM (Zulu 8.42.0.23-CA-macosx) (build 25.232-b18, mixed mode)
    a
    a
    • 3
    • 3
  • a

    Arthur

    01/12/2020, 1:29 PM
    Thanks for the suggestions @altavir! I work for the German Aerospace Centre and we to multi-dimensional analysis and optimization for multi-disciplinary aircraft design. Most of us still use Python but I try to show them the light of static typing and still having a nice syntax with kotlin 🙂
    a
    • 2
    • 1
  • a

    Arthur

    01/12/2020, 8:55 PM
    @carlw Seems like anything can be done in JFX 😄
    a
    t
    • 3
    • 4
  • a

    albrechtroehm

    01/14/2020, 5:01 PM
    Hey everyone, is there some documentation or site where i could lookup how to create something like derived / calculated properties for example a cost value which consist of a multiplication of 3 other properties? Another thing im struggling to find is how i can group together multiple properties and listen when one it changes. I found something like this
    private val costRecalculationTriggerProperty = SimpleObjectProperty<ObservableList<Property<*>>>(
          FXCollections.observableArrayList { p -> arrayOf<Observable>(p) })
    private var costRecalculationTrigger: ObservableList<Property<*>> by costRecalculationTriggerProperty
    Is there something else i could use which is kind of more readable?
    a
    g
    c
    • 4
    • 20
  • g

    geepawhill

    01/16/2020, 2:34 AM
    Dumb question: Does TornadoFx work with OpenJdk 13 & OpenFx 13? I've done a fair bit of tornadofx, but only ever used jdk8 environments.
    t
    a
    a
    • 4
    • 14
  • t

    tieskedh

    01/20/2020, 4:10 PM
    Does TornadoFX still want to support Java completely? Just interested, because I saw a lot of tiny functions that could be optimized by inlining
    a
    b
    • 3
    • 13
Powered by Linen
Title
t

tieskedh

01/20/2020, 4:10 PM
Does TornadoFX still want to support Java completely? Just interested, because I saw a lot of tiny functions that could be optimized by inlining
a

altavir

01/20/2020, 4:36 PM
I am not sure what is this about. Tornado is made of extensions. It means that it looks really ugly from Java.
t

tieskedh

01/20/2020, 4:45 PM
If I'm right, I remember that in the past, some choices are made to keep interoperability with Java better. (Don't know which ones, as it was a while ago) I do remember that the choice to support this interop was to make the migration from Java easier. But, If TornadoFX chooses to ignore Java, a lot of functions can be inlined. Or are there also other reasons not to do it?
a

altavir

01/20/2020, 4:46 PM
Could you give an example of such place? I mean for an inline?
t

tieskedh

01/20/2020, 4:50 PM
There are a lot of these, with almost no logic, but with lambda's
Untitled.kt
In short, functions that create/add a view, that have a body of around 4 lines and take a lamba. (almost all the functions in charts.kt)
a

altavir

01/20/2020, 5:32 PM
They won't win anything from inlining. Basically, you get the benefit of inlining only in cases, the lambda could be transformed into a cycle. Allocation of additional object in case of builder wont' win you anything
t

tieskedh

01/20/2020, 5:46 PM
The creation of lambda's don't have much overhead in normal code, but is pretty big if it can be optimized in a clockcycle?
a

altavir

01/20/2020, 5:46 PM
UI builders are not the places you should optimize.
Inlining is not always a good thing and you deffinitely should not do it without first studyig actual performance impact.
t

tieskedh

01/20/2020, 5:53 PM
Because of hotspots?
a

altavir

01/20/2020, 5:55 PM
Because JVM has very good inlining as it is and it usually can do better than user. I've done some experiments in this regard. Inlining should be used only when you actually want to do loops inisde.
t

tieskedh

01/20/2020, 5:57 PM
Ah, that's what you meant. I thought you meant a clock-cycle. And I understand. Thx for pointing this out!
b

bjonnh

01/20/2020, 9:24 PM
IMHO, the only place where one would eventually see benefit would be in high volume data-dependent widget creation.
View count: 6