java - Event calling through showInputDialog -


i'm build 1 application needs request user. first version of app made 1 input window myself, found better change showinputdialog since it's it's pre-molded tool joptionframe. i'm having problems event trigger; check out code below:

searchscreen:

public class searchscreen extends eventsearch{     ...     public searchscreen(){         userquery = (string) joptionpane.showinputdialog("type keywords in english requested below:");         }     ... } 

eventsearch:

public class eventsearch extends tabbuilder{      public eventsearch() {      }      public void actionperformed(actionevent ev) {         try {             system.out.println("worked");         } catch (ioexception e1) {             e1.printstacktrace(); //print failure             joptionpane.showmessagedialog(null, "fail");         }     }; } 

tabbuilder:

public class tabbuilder implements actionlistener {     ..... } 

then ask, how supposed call event through showinputdialog? possible? gonna listener? in advance

i found own answer - indeed carry on code event search class , pull trigger 1 action this, instead it's better do:

public searchscreen(){          userquery = (string) joptionpane.showinputdialog("type keywords in english requested below:");              try {                   //your action string                } catch (ioexception e1) {                  e1.printstacktrace(); //print failure                     joptionpane.showmessagedialog(null, "failure");             }      } 

Comments