snowe
08/15/2024, 10:20 PMconstrain
function also doesn’t seem to work. I have to set up the layout manually with rectangles.snowe
08/15/2024, 10:21 PMsnowe
08/15/2024, 10:22 PMNick
08/16/2024, 1:34 AMTextField
) actually delegate all rendering to a Behavior
. this is by design so that you can fully customize them. this applies to other common controls like buttons as well. you can fix this by either applying a theme that supports your control or using a behavior directly on your view. if you go the theme route (which should be simpler for a basic app), you'll need to install the nativeTextFieldBehavior module when launching your app, and install the theme that provides as follows.
class MyApp(display: Display, theme: Theme, themeManager: ThemeManager): Application {
init {
themeManager.selected = theme
val textField = TextField("test")
display += view {
size = Size(100, 50)
+ textField
layout = constrain(textField) {
it.width eq parent.width - 4
it.height eq 20
it.center eq parent.center
}
}
}
override fun shutdown() {
// no-op
}
}
fun main() {
// register native text field behavior
// this automatically makes a theme/theme manager available for injection
// all TextFields in your app will default to having the native behavior installed,
// which is required for them to render
application (modules = listOf(nativeTextFieldBehavior())) {
MyApp(
display = instance(),
theme = instance(), // inject theme
themeManager = instance() // inject theme manager
)
}
}
Nick
08/16/2024, 1:34 AMsnowe
08/16/2024, 4:44 AMNick
08/16/2024, 5:04 AMsnowe
08/16/2024, 5:05 AMsnowe
08/16/2024, 4:15 PM<textarea>
in doodle? I searched and couldn’t find it, and then thought maybe I could implement it myself but that is looking like it might not be easily possible.snowe
08/16/2024, 4:56 PMsnowe
08/16/2024, 6:11 PMException in thread "AWT-EventQueue-0" java.lang.ClassCastException: class org.jetbrains.skiko.SkiaLayer$1 cannot be cast to class javax.swing.JComponent (org.jetbrains.skiko.SkiaLayer$1 is in unnamed module of loader 'app'; javax.swing.JComponent is in module java.desktop of loader 'bootstrap')
at java.desktop/javax.swing.ToolTipManager.initiateToolTip(ToolTipManager.java:460)
at java.desktop/javax.swing.ToolTipManager$MoveBeforeEnterListener.mouseMoved(ToolTipManager.java:762)
at java.desktop/java.awt.AWTEventMulticaster.mouseMoved(AWTEventMulticaster.java:338)
at java.desktop/java.awt.Component.processMouseMotionEvent(Component.java:6666)
at
snowe
08/16/2024, 6:39 PMsnowe
08/16/2024, 6:47 PMtoolTipText = ""
in the doodle code.Nick
08/17/2024, 4:48 AMNick
08/17/2024, 4:51 AMsnowe
08/17/2024, 5:49 PMsnowe
08/17/2024, 5:52 PMNick
08/17/2024, 5:55 PMsnowe
08/17/2024, 6:13 PM