What’s the equivalent of Swing’s GridBagLayout in ...
# compose-desktop
n
What’s the equivalent of Swing’s GridBagLayout in Jetpack Compose Desktop? In particular I want columns to be sized to fit components in that column.
k
I hope none 🙂 Totally
I wouldn’t mind if somebody brings something a bit more modern like FormLayout or MigLayout over

https://www.youtube.com/watch?v=UuLaxbFKAcc

n
I don’t care about the precise class :-) However, I’m surprised by how hard it is to layout my components in a grid. All example code I’ve found involves either hard-coding the sizes of the columns or calculating the size myself.
o
I recently implemented a simple Table component, like, in few hours, and most time spent drawing lines between cells and properly measuring them, depending on the line width and such 🙂 Unfortunately, I didn’t yet open source it, because I don’t have proper context to do it. Considering contributing to https://github.com/JetBrains/compose-jb/tree/master/components, or maybe starting own project with components – I have some useful stuff to share
Usage would be something like this:
Copy code
Table(…) {
   row {
     cell { … }
     cell { … }
   }
   row {
     cell { … }
     cell { … }
   }
}
n
The design of the existing LazyVerticalGrid almost makes this possible, but the grid does not pass the content items to the strategy that computes the column sizes.
So close, yet so far 🙁
o
My table is not lazy at all, because, how would you do it?
n
That is a v good point