1
public void actionPerformed(ActionEvent evt)
{
if(combo1==true && !evt.getActionCommand().equals("correct"))
{
combo2 = true;
combo1 = false;
combo3 = false;
outText.setText("One more try!");
}
else if(combo2==true && !evt.getActionCommand().equals("correct"))
{
combo1 = false;
combo2 = false;
combo3 = true;
**outText.setText("Wrong!!");**
//sleep for 1 second
try {
Thread.currentThread();
Thread.sleep(1000);
}
catch (Exception ex)
{
System.exit(0);
}
System.exit(0);
}
else if(!evt.getActionCommand().equals("correct"))
{
combo1=true;
combo2=false;
combo3=false;
outText.setText("Two more tries!");
}
else
outText.setText("Correct");
}
이것은 올바른 대답을 얻으려는 내 코드의 일부입니다. 그러나 **로 표시된 줄은 거기에있는 수면 방법으로 작동하지 않습니다. 프로그램이 잠자기 후 닫히지 만 "틀린 !!" 잠들기 전에. 누군가가 나를 도울 수 있다면 그것은 대단히 감사하게 될 것입니다! 미리 감사드립니다.gui에서 수면 방법을 사용하면 작동하지 않습니다.
에서 자세한 내용을 참조하십시오? 오류가 있습니까? 'outText.setText ("한번 더 해보십시오!");'전혀 작동합니까? –
"Wrong !!"이 인쇄되지 않았습니다. 다른 모든 것들이 잘 작동했다. 하지만 이제는 해결되었습니다. 어쨌든 고마워요! – hotkoreanchick