IT/SWT
ESC 키 이벤트에 대한 예외처리
maze1008
2015. 2. 24. 00:58
SWT 를 사용하여 Progress Dialog 를 만들었는데
우연히 ESC 키를 눌렀더니 Dialog 가 사라져 버리는 현상을 발견하게 되었습니다.
Progress Dialog 는 다른 Dialog 와 다르게 ESC 키를 눌러도 닫히지 않아야 할 것 같아서
ESC 키 이벤트에 대한 예외처리를 해 보았습니다.
1
2
3
4
5
6
7
8 |
shell.addListener(SWT.Traverse, new Listener() {
public void handleEvent(Event e) {
if (e.detail == SWT.TRAVERSE_ESCAPE) {
e.doit = false;
}
}
});
shell.open(); |
cs |