New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash when I use JFXPanel #519
Comments
Hello! It looks like the initialization of the JFXPanel happens before the initialization of the SwingPanel, because both Swing and JavaFX have their own thread to dispatch events. So, if you try the following approach, it should solve your problem:
|
Looks so coooool! |
Can That will create a lot of JFXPanel(). Is it okay to do this? |
I think this is ok, but also I think that if you need to create a list from a large number of JavaFX items, you can use one JavaFXPanel as a container for a JavaFX ListView (or any other suitable component, because I am not very good at JavaFX framework) and fill it with JavaFX components with the proper styling to match your current CFD style. |
I see ~, thanks a lot 💕 |
how do i solve "LocalAppWindow.current.window" in compose 1.0.0-beta5? |
@Rsedaikin |
Great work with this example - currently using it with a I have noticed an implicit problem with using the Scenerio :
Expected : Digging deeper : It appears the first time you add a So far all good, however when this is called Once this method is called it will remove the listener, which makes sense for the lifecycle of this The end result is the compose application is still running but any calls to Workaround : Register a
|
It's work when i run the project via IDEA |
Sorry, I've found that I'll have a lot less trouble using swing , so I've given up on JavaFX |
but anyway it will use WEbView from JavaFX, or you know some other webview implementations without javafx ? (i wonna create chat with youtube player or site preview inside, but javaXF webview only one solution what i found... =( ) |
Same behavior happens to me. @theone55 Did you find solutions for this? |
It seems that the problem was some To fix that, I followed the tutorial at, Configuring included JDK modules | Native distributions & local execution | JetBrains/compose-jb, and as suggested by that tutorial, I ran the Demo Using the provided desktop-template, I made the following modifications to For
For
For
Then run P.S. Not sure if we should also worry about firewall settings, which may prevent the JavaFX Edit: The simplified |
Any idea Apple Sign In shows "Failed to verify your identity. Tray again." with JFX Webview? |
This is how i am using webviews, but its not getting disposed properly it opens for the first time but the second time it shows blank screen. @Composable
fun DesktopWebView(
modifier: Modifier,
url: String,
) {
val jPanel: JPanel = remember { JPanel() }
val jfxPanel = JFXPanel()
SwingPanel(
factory = {
jfxPanel.apply { buildWebView(url) }
jPanel.add(jfxPanel)
},
modifier = modifier,
)
DisposableEffect(url) { onDispose { jPanel.remove(jfxPanel) } }
}
private fun JFXPanel.buildWebView(url: String) {
Platform.runLater {
val webView = WebView()
val webEngine = webView.engine
// Set the user agent to simulate a browser for YouTube
webEngine.userAgent =
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3"
// Enable JavaScript support for YouTube embed player
webEngine.isJavaScriptEnabled = true
// Load the YouTube video using the embed URL
webEngine.load(url)
val scene = Scene(webView)
setScene(scene)
}
}
|
I want to use JavaFX in Compose-jb, but Compose-jb only support swing, so I use
JFXPanel
But,,,,,
kotlin.UninitializedPropertyAccessException: lateinit property layout has not been initialized
when I useJFXPanel
My Code
Error log
The text was updated successfully, but these errors were encountered: