querman
querman

Reputation: 135

Java GridBagLayout changing column size

I'm using gridbaglayout for layout manager. And its size 6*10. But when i change jlabel text that inside gridbaglayout all columns auto resized. How can i prevent this behavior? I wanna column and row size be fixed.

Upvotes: 0

Views: 5326

Answers (1)

KV Prajapati
KV Prajapati

Reputation: 94635

You need to set GridBagConstraints.gridwidth constraint. (Tutorial).

 GridBagConstraints gs=new GridBagConstraints();

/* It specify the number of columns in the component's display area */
 gs.gridwidth=3;

Upvotes: 1

Related Questions