Mitchell Syer

08/22/2021, 7:27 PM
Hello, I am running into a issue with setting a icon for my window, I believe its because of a incompatibility with the Swing Laf library I use called DarkLaf. I am wondering if this needs to be fixed on the Compose side or the DarkLaf side. There is a exception when window tries to open, I have added it to the thread.
:thread-please: 1
Adding stack trace to thread instead of the message
15:24:18.520 [AWT-EventQueue-0 @coroutine#23] ERROR/UncaughtException: Uncaught exception in thread [AWT-EventQueue-0 @coroutine#23@40]
java.lang.UnsupportedOperationException: getSource() not supported
	at ~[ui-graphics-desktop-1.0.0-alpha4-build315.jar:?]
	at java.awt.Image.getScaledInstance( ~[?:?]
	at ~[darklaf-windows-2.7.2.jar:2.7.2]
	at ~[darklaf-windows-2.7.2.jar:2.7.2]
	at com.github.weisj.darklaf.platform.decorations.CustomTitlePane.addNotify( ~[darklaf-platform-base-2.7.2.jar:2.7.2]
	at java.awt.Container.addNotify( ~[?:?]
	at javax.swing.JComponent.addNotify( ~[?:?]
	at java.awt.Container.addNotify( ~[?:?]
	at javax.swing.JComponent.addNotify( ~[?:?]
	at javax.swing.JRootPane.addNotify( ~[?:?]
	at java.awt.Container.addNotify( ~[?:?]
	at java.awt.Window.addNotify( ~[?:?]
	at java.awt.Frame.addNotify( ~[?:?]
	at ~[?:?]
	at ~[?:?]
	at java.awt.Component.setVisible( ~[?:?]
	at java.awt.Window.setVisible( ~[?:?]
	at androidx.compose.ui.window.AwtWindow_desktopKt$AwtWindow$4$1.invokeSuspend(AwtWindow.desktop.kt:122) ~[ui-desktop-1.0.0-alpha4-build315.jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.5.21.jar:1.5.21-release-314 (1.5.21)]
	at ~[kotlinx-coroutines-core-jvm-1.5.1.jar:?]
	at java.awt.event.InvocationEvent.dispatch( ~[?:?]
	at java.awt.EventQueue.dispatchEventImpl( ~[?:?]
	at java.awt.EventQueue$ ~[?:?]
	at java.awt.EventQueue$ ~[?:?]
	at [?:?]
	at$JavaSecurityAccessImpl.doIntersectionPrivilege( [?:?]
	at java.awt.EventQueue.dispatchEvent( [?:?]
	at java.awt.EventDispatchThread.pumpOneEventForFilters( [?:?]
	at java.awt.EventDispatchThread.pumpEventsForFilter( [?:?]
	at java.awt.EventDispatchThread.pumpEventsForHierarchy( [?:?]
	at java.awt.EventDispatchThread.pumpEvents( [?:?]
	at java.awt.EventDispatchThread.pumpEvents( [?:?]
	at [?:?]

Igor Demin

08/23/2021, 12:04 PM
I will look at it later, how it can be fixed. If you want to track it, you can fill an issue Until then you can use a workaround - set an icon directly, without passing it as a parameter
import androidx.compose.runtime.DisposableEffect
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.application
import javax.imageio.ImageIO

fun main() = application {
        onCloseRequest = ::exitApplication
    ) {
        DisposableEffect(Unit) {
            window.iconImage =
            onDispose {  }
👍 1