TornadoFX大杂烩

栏目: Java · 发布时间: 7年前

内容简介:注意:文章首发:
compile 'no.tornado:tornadofx:1.7.17'
compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

HelloWorld

import javafx.application.Application
import tornadofx.*

class App:tornadofx.App(MainView::class,MainStylesheet::class)

class MainView:View() {
    override val root = vbox {
        label("Hello World")
    }
}

class MainStylesheet:Stylesheet() {
    init {
        label {
            fontSize = 20.px
        }
    }
}

fun main(args:Array<String>) {
    Application.launch(App::class.java,*args)
}

进阶之Observable

import javafx.application.Application
import javafx.collections.FXCollections
import tornadofx.*

class App:tornadofx.App(MainView::class,MainStylesheet::class)

class Person(id: Int, name: String) {
    var id: Int by property(id)
    var name: String by property(name)
}

class MainView:View() {
    private val persons = FXCollections.observableArrayList(
            Person(10, "Ant"),
            Person(20, "Bee"),
            Person(30, "Cat")
    )
    override val root = tableview(persons) {
        column("ID", Person::id)
        column("name", Person::name)
    }
}

class MainStylesheet:Stylesheet() {
    init {
        label {
            fontFamily = "Noto Sans CJK SC Medium"
            fontSize = 20.px
        }
    }
}

fun main(args:Array<String>) {
    Application.launch(App::class.java,*args)
}

注意:

  • JavaFX可能对中文支持不好,最要手动设置中g字体

文章首发: https://baijifeilong.github.io


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Web Services原理与研发实践

Web Services原理与研发实践

顾宁刘家茂柴晓路 / 机械工业出版社 / 2006-1 / 33.00元

本书以web services技术原理为主线,详细解释、分析包括XML、XML Schema、SOAP、WSDL、UDDI等在内在的web Services核心技术。在分析、阐述技术原理的同时,结合作者在Web Services领域的最新研究成果,使用大量的实例帮助读者深刻理解技术的设计思路与原则。全书共有9章,第1章主要介绍web Services的背景知识;第2-7章着重讲解webServic......一起来看看 《Web Services原理与研发实践》 这本书的介绍吧!

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具