I am writing a desktop application using desktop compose. But unable to find any suggestion on how to use web-view like in android we are supposed to use.
For desktop-app, we can not use android web-view any help and suggestion will be highly appreciated.
I have implemented a JavaFX
WebViewin Compose Desktop (additional features of aWebViewhere - http://tutorials.jenkov.com/javafx/webview.html). My actual usecase was for mapping purposes as there is not really any decent mapping Java libraries. However this example just loads a web url, but you can easily load a customhtmlpage from resources that loads custom content.Setup as follows (note java fx plugin can only be used in actual desktop module not shared as it clashes with android library plugin).
desktop module
build.gradlefile :Mainkotlin file :Result :
Thanks goes to code in this original post which gives the bulk implementation of
JFXPanel- https://github.com/JetBrains/compose-jb/issues/519#issuecomment-804030550 and subsequent comment by myself around the Java FX event loop fix.