我想在gridbaglayout中链接2个单元格。我用netbeans,所以我用jappletform写。
JTextField dodawanyTextField = new javax.swing.JTextField();
dodawanyTextField.setText(nazwaLekcjiTextField.getText());
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridwidth = 2;
gridBagConstraints.gridx = 2;
gridBagConstraints.gridy = 2;
jPanel3.add(dodawanyTextField, gridBagConstraints);
但它不起作用。
1条答案
按热度按时间x7rlezfr1#
调整你的
GridBagConstraint's
weightx
以及fill
使组件沿x轴展开: