0

我正在使用 gridbaglayout 作为布局管理器。其尺寸为 6*10。但是,当我更改 gridbaglayout 内所有列的 jlabel 文本时,所有列都会自动调整大小。我怎样才能防止这种行为?我想固定列和行的大小。

4

1 回答 1

1

您需要设置GridBagConstraints.gridwidth约束。(教程)。

 GridBagConstraints gs=new GridBagConstraints();

/* It specify the number of columns in the component's display area */
 gs.gridwidth=3;
于 2011-12-29T14:31:28.000 回答