I'm trying create some JavaFX buttons with FontAwesomeFX icons using TornadoFX. This is the code
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
}
In compilation I get this error:
Type parameter bound for T in var <T : Enum<T!>!> GlyphIcon<T>.size: String! where T : GlyphIcons!
is not satisfied: inferred type CapturedTypeConstructor(*) is not a subtype of GlyphIcons!
The GlyphIcon is a Java abstract class with this declaration:
public abstract class GlyphIcon<T extends Enum<T> & GlyphIcons> extends Text
I don't know how turn around this error. If I declare:
data class ButtonInfo(val texto: String, val icon: Text)
I don't get the above mentioned error, but I miss '.size' property. How I can declare my class 'ButtonInfo' so that this code works?