Note that there are some explanatory texts on larger screens.

plurals
  1. POAlert window until method finishes execution in Swing
    primarykey
    data
    text
    <p>The shown image is my window made using <code>Swing</code>. </p> <p>How do I create an alert window when i click <code>Submit</code> button and the alert should display until the action performed is completed(alert+code should run in background) ?</p> <p>Here is my code snippet :</p> <pre><code>private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { //alert window should start here when button performed //and end based on the output i get DefaultHttpClient httpclient = new DefaultHttpClient(); jLabel3.setText(""); try { httpclient.getCredentialsProvider().setCredentials( new AuthScope(getHost(), AuthScope.ANY_PORT), new UsernamePasswordCredentials(getUser(), getPass())); HttpResponse response = null; HttpEntity entity = null; try { response = httpclient.execute(httpget); if(response.getStatusLine().getStatusCode()==500) { jLabel3.setText("Such Goods Movement does not exist / You do not have permssions for the entered."); //end here or } else if(response.getStatusLine().getStatusCode()==401) { System.out.println(response); jLabel3.setText("Auth Failed"); //end here or soon based on the event } entity = response.getEntity(); System.out.println(entity); if (entity != null) { InputStream instream = entity.getContent(); System.out.println(instream); BufferedReader reader = new BufferedReader( new InputStreamReader(instream)); String inputLine; String xmlText=""; while ((inputLine = reader.readLine()) != null) xmlText = xmlText+inputLine+"\n"; System.out.println(xmlText); try { DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xmlText)); DefaultTableModel model = (DefaultTableModel) jTable1.getModel(); model.setRowCount(0); Document doc = db.parse(is); NodeList nodes = doc.getElementsByTagName("MaterialMgmtInternalMovementLine"); for (int i = 0; i &lt; nodes.getLength(); i++) { Element element = (Element) nodes.item(i); getListGRNLine(element); } } catch (SAXException ex) { Logger.getLogger(GoodsReceipt.class.getName()).log(Level.SEVERE, null, ex); } catch (ParserConfigurationException ex) { Logger.getLogger(GoodsReceipt.class.getName()).log(Level.SEVERE, null, ex); } } } catch(UnknownHostException e){ jLabel3.setText("URL Not Found / Check Internet Connectivity"); } catch(NoRouteToHostException f){ jLabel3.setText("URL Not Found / Check Internet Connectivity"); } catch (IOException ex) { Logger.getLogger(GoodsReceipt.class.getName()).log(Level.SEVERE, null, ex); } try { EntityUtils.consume(entity); } catch (IOException ex) { Logger.getLogger(GoodsReceipt.class.getName()).log(Level.SEVERE, null, ex); } } catch (UnsupportedEncodingException ex) { Logger.getLogger(GoodsReceipt.class.getName()).log(Level.SEVERE, null, ex); } finally { // When HttpClient instance is no longer needed, // shut down the connection manager to ensure // immediate deallocation of all system resources httpclient.getConnectionManager().shutdown(); } } </code></pre> <p>Image Window : </p> <p><img src="https://i.stack.imgur.com/qckJV.png" alt="IMAGEWINDOW"></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload