그래서 while 루프를 여는 버튼이 있고, while 루프가 끝날 때까지 전체 GUI가 멈추고, 그걸로 내 GUI를 매초마다 업데이트 할 수있는 스레드가 어떻게 생겼겠습니까? 스윙 객체는 스레드로부터 안전하지 않습니다 그래서 당신이 시간에 어떤 나중에에서 실행되는 작업을 할 수 있습니다 SwingUtilities.invokeLater()
, 제공하고 있기 때문에 분명Java GUI를 쓰는 방법
JButton Test= new JButton();
Test.setText("Test");
Test.setSize(230, 40);
Test.setVisible(true);
Test.setLocation(15, 290);
Test.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e){
int x = 0;
while(x<500){
x++
});
이 – whyn0t
일반적인 자바 명칭 (이름 지정 규칙을 배울 바랍니다 https://docs.oracle.com/javase/tutorial/uiswing/concurrency/ - 예를'EachWordUpperCaseClass'이,'firstWordLowerCaseMethod()','firstWordLowerCaseAttribute'는 그것이하지 않는 한 'UPPER_CASE_CONSTANT') 일관되게 사용하십시오. –