import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JFrame; public class BorderLayoutEx extends JFrame { public BorderLayoutEx (){ setLayout(new BorderLayout()); //프레임 배치관리자 setTitle("BorderLayout 입니다"); 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"); this.add(bt1, BorderLayout.CENTER); this.add(bt2, BorderLayout.NORTH); this.add(bt3, BorderLayout.SOUTH); this.add(bt4, BorderLayout.EAST); this.add(bt5, BorderLayout.WEST); } public static void main(String[] args) { BorderLayoutEx e = new BorderLayoutEx(); } }
반응형
'Dev_Study > Java_backup' 카테고리의 다른 글
[JAVA / SWING] 배치관리자(Layout Manager) - BoxLayout (0) | 2016.10.07 |
---|---|
[JAVA / SWING] 배치관리자(Layout Manager) - GridLayout (0) | 2016.10.07 |
[JAVA / SWING] 배치관리자(Layout Manager) - FlowLayout (0) | 2016.10.07 |
[JAVA / SWING] 프레임 생성하기 (0) | 2016.10.07 |
[JAVA / SWING] 구조 (0) | 2016.10.07 |