java - Can't load Image into JTextArea using Swing -


i using jfilechooser load image desktop jtextarea when load image pc, software hangs.

here code of openactionperformed method of file chooser.

private void openactionperformed(java.awt.event.actionevent evt) {                                          int returnval = filechooser.showopendialog(this); if (returnval == filechooser.approve_option) {     file file = filechooser.getselectedfile();     try {       // file, e.g. display in textarea       textarea.read( new filereader( file.getabsolutepath() ), null );      } catch (ioexception ex) {       system.out.println("problem accessing file"+file.getabsolutepath());     } } else {     system.out.println("file access cancelled user."); } 

a jtextarea text not images.

if want display image add imageicon jlabel , add label jframe.

read section swing tutorial on how use icons more information on reading images , displaying icons.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -