컴포넌트들을 가로 방향으로 쭉 붙일때 사용된다
FlowLayout()
- 플로우 레이아웃 객체생성
컴포넌트는 가운데로 정렬되고, 각 컴포넌트간의 가로 세로 간격 5픽셀이다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | import java.awt.*; import javax.swing.*; public class SixButtons extends JFrame { protected JButton one,two,three,four,five,six; public SixButtons() { super( "폴로우 레이아웃" ); getContentPane().setLayout( new FlowLayout()); one = new JButton( "one" ); two = new JButton( "two" ); getContentPane().add(one); getContentPane().add(two); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setSize(300,200); setVisible( true ); } public static void main(String[] args) { // TODO Auto-generated method stub SixButtons sB = new SixButtons(); } } |
'Study > JAVA' 카테고리의 다른 글
인터페이스를 이용해 최대값 구하기 (0) | 2012.07.31 |
---|---|
자바 var (0) | 2012.07.18 |
Swing ??? (2) | 2012.07.09 |
final, static (0) | 2012.07.06 |
인터페이스 (0) | 2012.07.06 |