Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
920
Set Stretchproperty of a specific row
posted

Hello,

is there a possibility to set a stretch factor for a single row, e.g. when resizing a dialog I just want ONE row to stretch and all others should stay unchanged.

Regards

  • 469350
    Verified Answer
    Offline posted

    I think you could use the WeightY for this. I just tried a simple example with 4 buttons arranged in a square like so:

        Button1    Button2

        Button3    Button4

    I went to the GridBagLayout.GridBagConstraint of buttons 3 and 4 and set the WeightY of each to 1. This makes these buttons fill the available height and they are the only ones that resize when I size the panel.