import java.awt.GridLayout; import javax.swing.JButton; import javax.swing.JFrame; public class GridLayoutEx extends JFrame { public GridLayoutEx (){ setLayout(new GridLayout(0, 4)); //GridLayout(행, 열) setTitle("GridLayout 입니다"); setSize(300, 300); setLocationRelativeTo(null); //화면 중앙에 생성 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); JButton bt1 = new JButton("버튼1"); JButton bt2 = new JButton("버튼2"); JButton bt3 = new JButton("버튼3"); JButton bt4 = new JButton("버튼4"); JButton bt5 = new JButton("버튼5"); JButton bt6 = new JButton("버튼6"); JButton bt7 = new JButton("버튼7"); JButton bt8 = new JButton("버튼8"); JButton bt9 = new JButton("버튼9"); this.add(bt1); this.add(bt2); this.add(bt3); this.add(bt4); this.add(bt5); this.add(bt6); this.add(bt7); this.add(bt8); this.add(bt9); } public static void main(String[] args) { GridLayoutEx e = new GridLayoutEx(); } }
반응형
'Dev_Study > Java_backup' 카테고리의 다른 글
[JAVA / SWING] 성적관리 프로그램 v0.1 (0) | 2016.10.15 |
---|---|
[JAVA / SWING] 배치관리자(Layout Manager) - BoxLayout (0) | 2016.10.07 |
[JAVA / SWING] 배치관리자(Layout Manager) - BorderLayout (0) | 2016.10.07 |
[JAVA / SWING] 배치관리자(Layout Manager) - FlowLayout (0) | 2016.10.07 |
[JAVA / SWING] 프레임 생성하기 (0) | 2016.10.07 |