Open Walingar opened 7 months ago
Describe the bug When SwingPanel contains JPanel with BorderLayout and component in CENTER some content may be out of parent component on resizing
Affected platforms Select one of the platforms below:
Versions
To Reproduce Use this code:
import androidx.compose.foundation.layout.* import androidx.compose.material.Text import androidx.compose.ui.Modifier import androidx.compose.ui.awt.SwingPanel import androidx.compose.ui.unit.dp import androidx.compose.ui.window.singleWindowApplication import java.awt.Dimension import javax.swing.JPanel import javax.swing.JTree fun main() = singleWindowApplication { Box(modifier = Modifier.width(300.dp).width(200.dp)) { Column(modifier = Modifier.fillMaxWidth()) { Text("Text", modifier = Modifier) SwingPanel(factory = { JPanel().apply { add(JTree().apply { preferredSize = Dimension(200, 300) }) } }, modifier = Modifier.fillMaxWidth().height(200.dp)) } } }
And try to resize the window. Tree content will go away -- it shouldn't
While if we use such code:
import androidx.compose.foundation.layout.* import androidx.compose.material.Text import androidx.compose.ui.Modifier import androidx.compose.ui.awt.SwingPanel import androidx.compose.ui.unit.dp import androidx.compose.ui.window.singleWindowApplication import java.awt.Dimension import javax.swing.JPanel import javax.swing.JTree fun main() = singleWindowApplication { Box(modifier = Modifier.width(300.dp).width(200.dp)) { Column(modifier = Modifier.fillMaxWidth()) { Text("Text", modifier = Modifier) SwingPanel(factory = { JTree().apply { preferredSize = Dimension(200, 300) }) }, modifier = Modifier.fillMaxWidth().height(200.dp)) } } }
Everything works good
Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.
Describe the bug When SwingPanel contains JPanel with BorderLayout and component in CENTER some content may be out of parent component on resizing
Affected platforms Select one of the platforms below:
Versions
To Reproduce Use this code:
And try to resize the window. Tree content will go away -- it shouldn't
While if we use such code:
Everything works good