08/12/16 15:44:19
>>119
GridBagConstraintsを適切に設定してないんじゃないか
public class Test {
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.setLayout(new GridBagLayout());
frame.add(new JLabel("Label 1:"), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
frame.add(new JTextField(), new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
frame.add(new JLabel("Label 2:"), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
frame.add(new JTextField(), new GridBagConstraints(1, 1, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
frame.pack();
frame.setVisible(true);
}
}