mgarin / weblaf

WebLaF is a fully open-source Look & Feel and component library written in pure Java for cross-platform desktop Swing applications.
http://weblookandfeel.com
GNU General Public License v3.0
1.13k stars 234 forks source link

GroupPane content layout #583

Closed husker-dev closed 4 years ago

husker-dev commented 4 years ago

How can I configure GroupPane as on screenshot? I need to fill free space with the first WebButton. I have not found methods that can change layout.

image

mgarin commented 4 years ago

You can use custom constraints for GroupPane (it uses GroupPaneLayout):

GroupPane pane = new GroupPane ();
pane.add ( new JButton ( "Test" ), GroupPaneConstraints.FILL );
pane.add ( new JButton ( "-" ) );
TestFrame.show ( pane );

GroupPaneConstraints.FILL is a predefined one, but you can also create custom GroupPaneConstraints with custom sizes, you can check it's JavaDoc for more info: GroupPaneConstraints:47