나는 맥 OS 용 SWT 자바 프로젝트에서 일하고있다. 매 초마다 업데이트해야하는 SWT UI에 레이블을 추가해야한다. 시도했습니다. 즉매 초 다른 스레드에서 swt ui 업데이트하기
final Label lblNewLabel_1 = new Label(composite, SWT.CENTER);
FormData fd_lblNewLabel_1 = new FormData();
fd_lblNewLabel_1.left = new FormAttachment(btnNewButton_call, 10);
fd_lblNewLabel_1.bottom = new FormAttachment(100, -10);
fd_lblNewLabel_1.right = new FormAttachment(btnTransfer, -10);
fd_lblNewLabel_1.height = 20;
lblNewLabel_1.setLayoutData(fd_lblNewLabel_1);
getDisplay().syncExec(new Runnable() {
@Override
public void run() {
while(true){
lblNewLabel_1.setText(Calendar.getInstance().getTime().toString());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
그러나 작동하지 않습니다. 도와주세요. 사전에 감사합니다.
이 보이는 코드를 다음 exactly..using했다. 당신은 그때 그의 대답을 upvote 받아 받아 들여야합니다 ... – Baz
나는 그 대답을 받아 들였지만, 최소 15 명 이상의 평판이 필요하기 때문에 투표를하지 않았습니다. –
이제 15 평판을 얻었습니다.) – Baz