简体   繁体   中英

handle listview double click with tornadofx

I want to handle a double click on a tornadofx listview but I get an exception:

java.lang.NoClassDefFoundError: com/sun/javafx/scene/control/skin/TableColumnHeader
    at tornadofx.NodesKt.isInsideRow(Nodes.kt:492)
    [...]

In the code below if I use onDoubleClick it works, but I'd like to be able to use onUserSelect or at least understand why this doesn't work.

package com.example.demo.app

import tornadofx.*

class MainView : View("listview demo") {
    val things = SortedFilteredList<String>()

    init {
        things.add("aaa")
        things.add("bbb")
    }   

    override val root = listview(things) {
        onUserSelect {
            println("user select")
        }   
        /*  
        onDoubleClick {
            println("double click")
        }   
        */  
    }   
}   

class MyApp: App(MainView::class)

Running ubuntu 18.04.3. Building with gradle 5.6.3, kotlin 1.3.50, tornadofx 1.7.19. The gradle javafxplugin is getting the default javafx but I have also tried specifying versions 11-13 explicitly and get the same behavior. I also tried installing ubuntu openjfx package version 11.0.2+1-1~18.04.2.

Sounds like you're trying to run TornadoFX 1 with JDK/JavaFX newer than 8. Please either downgrade Java/JavaFX to 8, or run with TornadoFX 2.0.0-SNAPSHOT, which is available from oss.sonatype.org. This version supports Java/JavaFX 13.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM