2006. 10. 13. 22:11
Programing/Java
final Button button = new Button(shell,SWT.BUTTON1);
button.pack();
button.setSize(100,30);
button.setText("눌러봐");
button.pack();
final Button closebutton = new Button(shell,SWT.BUTTON1);
closebutton.pack();
closebutton.setSize(100,30);
closebutton.setLocation(110, 0);
closebutton.setText("창닫어");
button.pack();
button.setSize(100,30);
button.setText("눌러봐");
button.pack();
final Button closebutton = new Button(shell,SWT.BUTTON1);
closebutton.pack();
closebutton.setSize(100,30);
closebutton.setLocation(110, 0);
closebutton.setText("창닫어");
위 버튼은 다음과 같이 출력된다.
두개의 버튼은 각각 100,30 으로 크기를 지정해 주었다.
오른쪽의 창 크기가 100 * 30으로 지정한 크기대로 출력이 되었다.
왼쪽 창의 크기는 지정해준 크기가 아니다.
두 코드의 다른점을 보면 오른쪽 버튼의 소스에는 Control.pcak()메서드가 없다.
Control.pack()메서드의 역할은 바로 이것이다.
적당한 크기로 바꿔주는것.
일일이 control마다 setSize를 해줄 필요가 없을것 같다.
'Programing > Java' 카테고리의 다른 글
윈도우 Java환경 설정 (0) | 2006.12.23 |
---|---|
에디트플러스 자바 컴파일/실행 설정 (0) | 2006.10.16 |
SWT 연습 - FileTreeContentProvider (0) | 2006.10.13 |
SWT Study (0) | 2006.10.13 |
SWT 연습... (0) | 2006.10.13 |