swing - Java Program is not Calling Method -
public void startscanning() { // check if there webcam available if (cameraview.getwebcampanel() == null) { return; } // make sure webcam not null if (cameraview.getwebcam() == null) { return; } if (!cameraview.getwebcam().isopen()) { cameraview.getwebcam().open(); } // make sure webcam open if (cameraview.getwebcam().isopen()) { // create swingworker thread run in background worker = new swingworker<void, void>() { try { qrresult = new multiformatreader().decode(bitmap); //system.out.println("qrresults: " + qrresult); try { // new error handling int length = qrresult.gettext().length(); if(length != 23){ joptionpane.showmessagedialog(null, "username , password correct"); startscanning(); } // end of error handling
i omitted of syntax, reason startscanning() method not called @ end. dialog box shown, method isn't called. can please explain why?
i suppose, it's related joptionpane.showmessagedialog
. mesagedialog has closed before program proceeds. , can throw headlessexception
if don't have graphics device show dialog at.
check open windows , implement catch
try
block.
a small example program show what's happening:
public static void main(string[] args) { joptionpane.showmessagedialog(null, "message"); system.out.println("done"); }
the console output done
appear, if have graphics device, , after closed dialog window.
Comments
Post a Comment