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
  • g

    groostav

    11/12/2020, 8:49 PM
    if i could even get intelliJ to flag something like
    resourceBundle.get("MizzspelledKey")
    with "this lookup is suspicious" would be a step forward
    m
    • 2
    • 11
  • m

    melatonina

    11/14/2020, 9:04 AM
    How do you guys do when using collections of FX controls, like ControlsFX, with TornadoFX? Do you write all the builders or just go with
    apply
    blocks and
    add
    ?
    s
    b
    • 3
    • 7
  • m

    melatonina

    11/14/2020, 6:11 PM
    Switching to Compose will be a pleasure just for leaving the FX layout system behind. I used a dozen GUI toolkits in my life and never had so much pain.
    💯 1
    a
    r
    • 3
    • 3
  • s

    Samkeene

    11/14/2020, 6:23 PM
    Are there any good alternatives for kotlin desktop application dev?
    a
    • 2
    • 1
  • m

    melatonina

    11/14/2020, 9:33 PM
    @Samkeene: JavaFX. Depending on your needs, JavaFX may be, all things considered, just as good as TornadoFX: you may miss a few things, but you would also not deal with a major component that is not actively developed and whose design is flawed and dated in many regards. Software ecosystems are in constant evolution, and not being developed and updated is a huge problem. I started FX development with TornadoFX, and I had to learn how JavaFX does things and then also how TornadoFX does the same thing, just for saving a few keystrokes here and there. Probably it's the kind of software I'm writing. I don't care about most of the extra features of TornadoFX, because they are obsoleted or geared towards line-of-business applications. So-called "creative" applications often are not well served by "standard" toolkits, to be honest. For example, "editing information" in my application is kinf of particular and looks very different from the "editing model" of TornadoFX (why the author used the name ViewModel for what is an "edit model" is beyond my comprehension). I'm also writing an application which is the desktop version of a mobile-first application, so I'm influenced by that for many reasons and less likely to adhere to the assumptions at the base of TornadoFX. My point is that, being TornadoFX not developed anymore and with no signs of any kind of plans for the complete redesign that it needs in order to fit its possible niche, in 2020, learning TornadoFX may be not worth the effort. Cognitive effort is a price. Stockholm syndrome may happen when you spend very much effort learning a piece of software.
    a
    • 2
    • 2
  • m

    melatonina

    11/14/2020, 9:35 PM
    Is this really the way to center an image in ImageView? https://stackoverflow.com/questions/32781362/centering-an-image-in-an-imageview/32866286#32866286
    • 1
    • 1
  • m

    melatonina

    11/15/2020, 10:42 AM
    In order to say something positive and constructive about TornadoFX, since I criticized it several times here, I want to mention that IMHO a new version of TornadoFX should separate the "builder DSL" from the other components. The DSL should be generate as much as possible via metaprogramming, and not by hand. The team working on this DSL should cooperate with the JavaFX team in order to synchronize the releases and possibly evolve the JavaFX API to make the metaprogramming easier (even if just by annotating the classes and the methods). Annotating the JavaFX API where necessary for making metaprogramming the DSL effective would lay the basis for libraries of JavaFX controls to using the same annotations and get the DSL for free. The other features should be moved in other modules (as it was already planned somehow). Some of the features, like serialization and networking via HTTP, should be removed and replaced by the equivalent "standard" libraries in the Kotlin ecosystem. And coroutines. With "should" here I mean that in my opinion these are the minimal set of changes required to make the project maintainable and appealing to as much of the the Kotlin developer audience as possible, so that it can make any sense and possibly gain some kind of financial support. It's very hard for just one developer to guide TornadoFX through this evolution through the years. This is probably why TornadoFX went from being innovative to being covered by a certain layer of dust. Not because the author is not good. This is not a personal attack. A project like this requires more than one pair of hands and more than one head.
    j
    s
    j
    • 4
    • 6
  • k

    Kirill

    11/19/2020, 7:15 PM
    Hello Tornadoers. Does anyone have an idea regarding following in TornadoFX? If there are multiple instances of the same Fragment, but with different state and data, is it possible to have different instances of the Controller for each of those Fragments?
    s
    • 2
    • 5
  • a

    Alain Leblanc

    11/23/2020, 1:14 AM
    Trial and error 🙂 The
    vbox
    class has a method named getChildList() which returns a mutable list of the element in the vbox. You can remove and add to this lists using
    removeAt(i)
    and
    add (i, NewContent)
    . In your case
    i
    is likely to be 1, but you may have to experiment a bit. Print out the contents of the different element as you're testing to figure out exactly what you need to modify.
    n
    s
    • 3
    • 7
  • w

    WildOne (Yuri)

    11/23/2020, 10:41 PM
    Um... hi 🙂 Really new to Java/Kotlin, and asking for help implementing my first serious application. It's a connector that interfaces GPS reports (and some other things) from digital radios into a really legacy and clunky mapping software (OziExplorer, anyone? dammit... its API is horrendous!) Now for the TornadoFX question: how should I implement a UI item that would change its caption depending on an external Boolean fun? Seems like I'd still need to bind this to a property and somehow tell TFX to refresh it?
    s
    • 2
    • 11
  • m

    Matej Moravec

    11/24/2020, 8:35 AM
    Hello, I have a question regarded to TabPane component. I have the "Main" View, which is divided into two Views, "Menu" View and "Content" View. I have TabPane in "Main" View, and I want to add a new tab from "Menu" View. I believe that this is possible, but I am quite new to TornadoFX, and I cannot find the solution. I would be grateful if someone can help me with this. :)
    s
    • 2
    • 1
  • l

    lazt omen

    11/25/2020, 3:12 PM
    Hi i want to build a schematics system based on pipes, my question is how can I build composed objects like a t using basic shapes like a rectangle to be create the pieces
    m
    • 2
    • 3
  • m

    mariofelesdossantosjr

    11/28/2020, 12:42 PM
    Hello friends, is it possible to implement a debounce action on the button click?
    s
    m
    • 3
    • 7
  • w

    WildOne (Yuri)

    12/05/2020, 9:25 AM
    Hello there. Can anyone help me understand how I should handle errors in tornadofx? How does event filtering work?
    a
    b
    m
    • 4
    • 3
  • h

    Hamza

    12/12/2020, 4:15 AM
    Hey everyone, is there any possible way to run a tornadofx compiled application on a device with java 14? It doesn't have javafx bundled anymore so would I have to require my clients to install java 8? Alternatively, is there perhaps some way to bundle openjfx in my application as an alternative to work with tornadofx?
    h
    m
    • 3
    • 4
  • j

    Jgafner

    12/29/2020, 7:37 PM
    Hi all Someone ever saw issue like this in text?
    r
    m
    • 3
    • 6
  • m

    Marshall

    01/07/2021, 10:17 PM
    Is there a better way to do read only properties?
    private val isRunningWrapperProperty = ReadOnlyBooleanWrapper(false)
        var isRunning by isRunningWrapperProperty
            private set
        fun isRunningProperty(): ReadOnlyBooleanProperty = isRunningWrapperProperty.readOnlyProperty
    m
    j
    • 3
    • 2
  • k

    Katrina Eaton

    01/20/2021, 3:23 PM
    Hello, I was wondering if there's something sort of like a style guide for building GUIs using TornadoFX? I know what I want to do, and even have some idea of how to do it, but are there things I should be leaning towards like dependency injection, or fragment use, etc? The best example I can find is in the TornadoFX documentation: "but using  inject()  delegates is the most idiomatic means to perform dependency injection and has the advantage of lazy loading." That's great, now I know to use inject() over find() where possible. Are there other idiomatic things about TornadoFX that I need to know besides what's in the documentation, and if so, do you have any suggestions as to where I should look for this information?
    o
    a
    • 3
    • 2
  • a

    amiracam

    01/23/2021, 11:58 PM
    hi, I'm contemplating getting back into TornadoFX but I'm confused about TornadoFX 2 . Is that ready for prime time ? If so can somebody share a link to what's needed to setup an Intellij TornadoFX 2 project . Also, does the Intellij TornadoFX plugin support TornadoFX 2 . thanks
    a
    • 2
    • 3
  • m

    mikehearn

    02/01/2021, 11:53 AM
    If there’d be interest in this idea, please do let me know. TornadoFX is abandoned but I’m starting to look around for a new project, and I have a fondness for JavaFX - ultimately, despite its neglect, the base engineering was very good. Jetpack Compose doesn’t quite seem right to me, partly because it’s a mobile toolkit (not so great for building complex database backed enterprise apps with lots of forms and charts), and partly because the whole attempt to make GUI “functional” seems wrong - a GUI is at heart mutable state. It’s the way the user mutates the state of your app. Trying to make something fundamentally mutable look and feel immutable seems like a square peg/round hole problem.
    m
    • 2
    • 8
  • n

    Nico Smeenk

    02/01/2021, 7:38 PM
    Heyho, quick and hopefully simple question: I have an observable list as my model. I want to paint a circle for each item in the list and refresh (add circles) when there are new Items in the list. Is there a way to achieve this with some kind of "fake control" where I bind the list? Or do I need to add my own change listener to the list and update the UI? Thanks!
    • 1
    • 1
  • g

    geepawhill

    02/02/2021, 5:15 PM
    @Samkeene just a late thank you, Sam, for your template from way back September. I had only one tweak to get it running on my side: IntelliJ wasn't using the 15 jdk to run Gradle. I did make a couple of minor changes afterwards, but they're about my testing preferences. Had I done it myself it would have taken hours and been garbage. Yours took me 15 minutes and and I actually understand it. So. Big props! Folks, if you want openJdk 15 and openjfx 15 and tornadofx 2, this is a nice tight gradle template. https://github.com/SKeeneCode/TornadoFX-Template
    s
    • 2
    • 1
  • l

    Leonid

    02/05/2021, 8:57 AM
    Hey! Not really a TornadoFX question, but JavaFX one 🙂 When a
    TableView
    is made editable, every mouse double click / mouse single click on a selected cell / [Enter] press starts cell edit. This is pretty annoying, is there an easy way to disable it? I have a dedicated button in the UI to trigger cell edit.
    b
    • 2
    • 1
  • g

    groostav

    03/10/2021, 12:27 AM
    hey guys im having a nightmare getting scenicview running on java 13, has anybody run it with something after java 11? how did you do it?
    b
    s
    • 3
    • 2
  • d

    diniamo

    03/14/2021, 5:42 PM
    Hey, how would I go about displaying a very big amount of text? Minimum 200k lines.
    s
    b
    • 3
    • 4
  • d

    diniamo

    03/14/2021, 6:19 PM
    Also, how do I export to a Windows Application? I heard you could do it with LauncherFX, but I couldn't figure it out.
    b
    s
    • 3
    • 29
  • m

    mariofelesdossantosjr

    03/24/2021, 11:34 AM
    How to discard objects at the end of a screen, I'm having a memory problem?
    s
    • 2
    • 1
  • s

    Samkeene

    03/25/2021, 6:45 PM
    I love tornadofx but it's been in limbo for a while now. There have been numerous discussions on github and here overtime about the project needing new maintainers. Aleksander here perfectly states the problem: "I think that many people are eager to contribute to this repository, but the work to be done is undefined". Jacek here has created a gradle tornadofx2 which many of people have asked for (and IMO should replace the maven version). Edvin has repeatedly indicated he is open to letting others maintain. Would people here be willing to throw their hat in the ring and sit down and discuss the direction of the project, and potentially take on various degrees of responsibility with regards to the project? If we can get a handful of people we could perhaps take some first steps. Please reply to this thread if you would be interested!
    👍 1
    k
    a
    l
    • 4
    • 6
  • w

    WildOne (Yuri)

    04/02/2021, 5:08 PM
    noob question: how do I tell a textfield to react to the Enter key being pressed?
    b
    • 2
    • 4
  • d

    diniamo

    04/07/2021, 7:58 AM
    Hey, I've been stuck on this problem for quite a while now... So I'm trying to add my custom fonts from resources, and I have this CSS code for adding them:
    @font-face {
        -fx-font-family: "Poppins", poppins;
        -fx-font-weight: bold;
        src: url('../font/Poppins-Bold.ttf');
    }
    @font-face {
        -fx-font-family: "Poppins", poppins;
        -fx-font-weight: medium;
        src: url('../font/Poppins-Medium.ttf');
    }
    @font-face {
        -fx-font-family: "Poppins", poppins;
        -fx-font-weight: medium;
        -fx-font-style: italic;
        src: url('../font/Poppins-MediumItalic.ttf');
    }
    But when I tried to apply them it doesn't work. I mostly use medium and when I try to set the font-weight, on a label let's say I get this error:
    main-view.css: Expected '<font-weight>' while parsing '-fx-font-weight' at [13,21]
    I have found some StackOverflow questions, but none of the answers seem to have helped.
    v
    s
    • 3
    • 37
Powered by Linen
Title
d

diniamo

04/07/2021, 7:58 AM
Hey, I've been stuck on this problem for quite a while now... So I'm trying to add my custom fonts from resources, and I have this CSS code for adding them:
@font-face {
    -fx-font-family: "Poppins", poppins;
    -fx-font-weight: bold;
    src: url('../font/Poppins-Bold.ttf');
}
@font-face {
    -fx-font-family: "Poppins", poppins;
    -fx-font-weight: medium;
    src: url('../font/Poppins-Medium.ttf');
}
@font-face {
    -fx-font-family: "Poppins", poppins;
    -fx-font-weight: medium;
    -fx-font-style: italic;
    src: url('../font/Poppins-MediumItalic.ttf');
}
But when I tried to apply them it doesn't work. I mostly use medium and when I try to set the font-weight, on a label let's say I get this error:
main-view.css: Expected '<font-weight>' while parsing '-fx-font-weight' at [13,21]
I have found some StackOverflow questions, but none of the answers seem to have helped.
v

Vladimir N.

04/08/2021, 11:48 AM
Does -fx-font-weight have medium property?
d

diniamo

04/08/2021, 12:32 PM
It does, but I have also tried with 500px, and same issue.
v

Vladimir N.

04/08/2021, 1:01 PM
Really? What JavaFx version you use?
d

diniamo

04/08/2021, 1:02 PM
I followed the TornadoFX setup guide and I use jdk 11.
v

Vladimir N.

04/08/2021, 1:02 PM
<font-weight> The font's weight, using the following syntax: [ normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 ]
https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/doc-files/cssref.html
d

diniamo

04/08/2021, 1:34 PM
I see, but as I said, I tried 500px.
v

Vladimir N.

04/08/2021, 1:35 PM
Did you use 500px string or just 500?
d

diniamo

04/08/2021, 1:36 PM
I used 500px, because my ide recommended it.
v

Vladimir N.

04/08/2021, 1:37 PM
I think you should use 500 without px
d

diniamo

04/08/2021, 1:47 PM
So @Vladimir N. how do I fix this?
v

Vladimir N.

04/08/2021, 1:48 PM
Can you try to replace
medium
to
500
?
@font-face {
    -fx-font-family: "Poppins", poppins;
    -fx-font-weight: 500;
    -fx-font-style: italic;
    src: url('../font/Poppins-MediumItalic.ttf');
}
d

diniamo

04/08/2021, 1:50 PM
Without px?
Alright I'll try that when I get home.
@Vladimir N. no errors now, that's good! But it seems like I'm just getting the regular version of the font rendered.
Looking at my app in scenic view it says, it's using `System Bold`/`System Regular`as the font. Which is obviously not what I want.
s

Samkeene

04/09/2021, 1:55 PM
@diniamo try this, I created a minimal example for you: https://gist.github.com/SKeeneCode/313bcb6183193877f8a3e484581f74cf
Also I do like that font... might have to use it now in my applications :)
d

diniamo

04/09/2021, 2:44 PM
@Samkeene I see, thanks! But I wanted to keep all the styling in css.
s

Samkeene

04/09/2021, 2:46 PM
Are you not using tornadofx?
Nevertheless https://edencoding.com/resources/css_properties/fx-font-weight/ should be all you need if you want to remain pure css!
d

diniamo

04/09/2021, 4:28 PM
I am using tornadofx, yes.
Alright I tried doing that, didn't work, I'll make the repo public and send the link here, one second.
https://github.com/diniamo/sm-pixel-art-creator Here you go. It's still using System fonts.
s

Samkeene

04/09/2021, 5:29 PM
What exactly did you try? Also, consider upgrading to javafx 16 and tornadofx2, as it may be something that was fixed in later versions.
d

diniamo

04/09/2021, 6:03 PM
Well, you can look at the project for what I tried? And how exactly do I upgrade?
s

Samkeene

04/09/2021, 6:39 PM
Well, you can upgrade javafx easy enough in your build gradle. You clone and build tornadofx2 yourself : https://github.com/edvin/tornadofx2 or get its snapshot release from sonotypes repo. You haven't mentioned any css errors in the console so I'm assuming the fonts are loaded correctly. The other css properties you have in main-view.css such as border color and width are being correctly applied to the appropriate node right?
I cloned and built your project - the fonts will work if you move the
@font-face
declarations into the
main-view.css
- this isn't ideal, maybe its a quirk of javafx css that I am not aware..
d

diniamo

04/09/2021, 7:09 PM
No errors, and yes the other stuff is getting applied.
Moving it is not what I wanted, and I use the font in another css file.
s

Samkeene

04/09/2021, 7:33 PM
using
loadFont
also works
Oh I finally figured it out
Always the silly things
your
font-face
declarations need to be the first thing in the css file, you have a
root
declaration above them. Move that under and it all works.
d

diniamo

04/09/2021, 8:03 PM
Sounds stupid, but I'll try that.
It works, thank you so much.
View count: 4