사용자가 아니요 또는 취소를 클릭하면 닫히는 대화 상자를 만들고 예를 누르면 스크립트가 계속되지만 어떤 이유로 아래 코드를 작동시킬 수 없습니다.
this.finish(); Process.killProcess( Process.myPid() );
//default title and icon
int dialogButton= JOptionPane.YES_NO_CANCEL_OPTION;
int dialogResult = JOptionPane.showConfirmDialog(null, "do you plan on attending a local technology center?", "Info",dialogButton);
if(dialogResult==JOptionPane.YES_OPTION){
//Code for YES Button Clicked
}
else if(dialogResult==JOptionPane.NO_OPTION)
{
//Code for NO Button Clicked
this.finish(); Process.killProcess( Process.myPid() );
}
else if(dialogResult==JOptionPane.CANCEL_OPTION){
//Code for CANCEL Button Clicked
this.finish(); Process.killProcess( Process.myPid() );
}
제목으로 판단하면 컴파일 오류가 발생한다고 가정합니다.
게시 한 코드는 static
메소드에 있을 가능성이 있습니다.
을 참조하기 때문에 메서드 에서 this
키워드를 사용할 수 없습니다 . 클래스 수준에서 실행중인 메서드를 실행할 때 개체가 아닌 클래스에 대한 메서드를 호출합니다. 여기서 키워드는 말도 안됩니다.static
this
object
static
this
FIX : 메서드 finish
를 정적으로 선언 하고 this
.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다