Java低速GUI Swing 8at TECH
Java低速GUI Swing 8 - 暇つぶし2ch121:デフォルトの名無しさん
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);
}
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch