Runtime Photo Display.

Q20. Design a Java NetBeans GUI application to display a photo while program is running.

Sol:

 

Code For Upload

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

String url;

url=jTextField1.getText();

jLabel1.setIcon(new ImageIcon(url));

}

Code For Clear

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

// TODO add your handling code here:

jLabel1.setIcon(new ImageIcon(“”));

}

Output

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *