Tag: tornadofx

不能与kotlin和tornadofx一起使用fontawesomefx

我正在尝试使用TornadoFX创建一些带有FontAwesomeFX图标的JavaFX按钮。 这是代码 data class ButtonInfo(val texto: String, val icon: GlyphIcon<*>) val list = listOf( ButtonInfo("Cadastro", FontAwesomeIconView(FontAwesomeIcon.ADDRESS_BOOK)), ButtonInfo("Corrida", MaterialDesignIconView(MaterialDesignIcon.RUN)), ButtonInfo("Classificacao", FontAwesomeIconView(FontAwesomeIcon.LIST))) list.forEach { it.icon.size = "3em" val bt = Button(it.texto, it.icon) bt.contentDisplay = ContentDisplay.TOP bt.minWidth = 200.0 root += bt } 在编译时,我得到这个错误: Type parameter bound for T in var <T : Enum<T!>!> GlyphIcon<T>.size: String! where T […]

Gradle编译在Linux上找不到tornadofx

我想用gradle编译一个kotlin应用程序。 该应用程序使用tornadofx(javafx的kotlin版本)。 在build.gradle ,我有: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" compile 'no.tornado:tornadofx:1.7.8' compile 'com.squareup.moshi:moshi:1.5.0' compile 'com.squareup.moshi:moshi-kotlin:1.5.0' // Required for local unit tests (JUnit 4 framework) testCompile 'junit:junit:4.12' } 在MyApp.kt我有: import javafx.application.Application import tornadofx.App 当我在Windows 10上编译这个项目时,无论是使用gradle clean build还是.\gradlew clean build ,它都能编译并完美工作。 当我在Ubuntu Linux上编译这个项目时,我得到一个错误消息页面,其中包括: … e: Supertypes of the following classes cannot be resolved. […]

如何用Kotlin和Tornado FX设置Gluon应用程序

我目前尝试将以下技术结合起来: 胶子(手机) Gradle(依赖于Gluon,因为他们依赖它) Kotlin(因为这是一个很好的语言,我想深入) 龙卷风FX(我想这是JavaFX,Anko是Android的) 问题是,我对Intellij-IDEA相对比较陌生,并且在正确设置它的时候遇到了问题,尽管我认为build.gradle文件是足够合适的。 这是我的build.gradle看起来如此之远: buildscript { ext.kotlin_version = '1.0.6' repositories { jcenter() mavenCentral() } dependencies { classpath 'org.javafxports:jfxmobile-plugin:1.2.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } apply plugin: 'org.javafxports.jfxmobile' apply plugin: 'kotlin' // apply plugin: 'com.android.application' // apply plugin: 'kotlin-android' repositories { jcenter() mavenCentral() maven { url 'http://nexus.gluonhq.com/nexus/content/repositories/releases' } } mainClassName = 'eu.dzim.test.Main' dependencies { compile […]

从(现有的)Kotlin程序启动TornadoFX应用程序

fun main(args: Array<String>) { HelloWorldApp().launch() } fun App.launch() { JFXPanel() Platform.runLater({ start(Stage()) }) } 这就是我现在所做的。 有没有更好的? 更简洁的方式? 以同样的方式在同一个kotlin程序中运行多个不同的TornadoFX应用程序是否安全? 我读了一些关于全局变量的地方,所以我想知道是否只允许/推荐1。

tornadofx ViewModel和ItemViewModel中的kotlin var属性

根据文档,kotlin var属性可以在ViewModel中绑定为 // Kotlin var property class PersonVarViewModel(person: Person) : ViewModel() { val name = bind { person.observable(Person::name) } } 这似乎是行不通的。 如何解决这个问题。 IDE显示红色下划线“绑定”,但如果我写 val name = bind(RoomType::name) 它显示没有错误。 但使用UI字段更新值不会更新模型值。 请帮忙

如何在Kotlin中实现TornadoFX WebEngine回调

我正在使用Kotlin TornadoFX创建一个浏览器。 当我实现WebEngine setCreatePopupHandler时,我得到一个错误: e:surfing \ src \ surfing.kt:(76,13):修饰符“覆盖”不适用于“本地功能” e:surfing \ src \ surfing.kt:(76,13):期望WebEngine类型的值! 我使用JavaFX引用了这个Java代码: webEngine.setCreatePopupHandler( new Callback<PopupFeatures, WebEngine>() { @Override public WebEngine call(PopupFeatures config) { smallView.setFontScale(0.8); if (!toolBar.getChildren().contains(smallView)) { toolBar.getChildren().add(smallView); } return smallView.getEngine(); } }); 翻译成Kotlin使用TornadoFX: var wv = webview() val br = wv.getEngine() br.setCreatePopupHandler(Callback<PopupFeatures, WebEngine>() { override fun call(pf: PopupFeatures): WebEngine { var […]