compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

SwingPanel requires a fixed content size

Open rock3r opened this issue 1 year ago • 1 comments

Describe the bug If you don't set a fixed size on SwingPanel and its contents, the component will have an arbitrary size or cause crashes in the Compose Node layout pass.

Affected platforms Select one of the platforms below:

  • Desktop

Versions

  • Kotlin version*: 1.7.20
  • Compose Multiplatform version*: 1.2.1
  • OS version(s)* (required for Desktop and iOS issues): macOS/Swing
  • OS architecture (x86 or arm64): arm64 but irrelevant
  • JDK (for desktop issues): 17

To Reproduce Steps and/or the code snippet to reproduce the behavior:

  1. Create an IJ plugin project (using the template in the samples in this repo)
  2. Create a LazyColumn and add items to it
  3. Make those items be a SwingPanel that contains a non-size-constrained JComponent
  4. Observe the items get sized incorrectly

Expected behavior Components shouldn't have to be fixed size, as it's a big limitation. You don't always know what size you need in advance.

rock3r avatar May 25 '23 10:05 rock3r

I have a repro here: https://github.com/rock3r/cfd-repros/blob/main/src/main/kotlin/ComposePanelFixedSize.kt

The ComposePanel's content doesn't show up unless I set a fixed height on it. If I use heightIn(minH, maxH) the panel will always be sized to minH, which is also wrong. I suspect this to be related to #4556, but it's slightly different.

The original crash I was seeing happened because I used an IntelliJ's EditorTextField inside it, which is scrollable, and I was in a LazyColumn. In the simple repro, there is no crash, but it still does not work as intended.

rock3r avatar May 06 '24 14:05 rock3r

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.

okushnikov avatar Aug 26 '24 13:08 okushnikov