Import java. Io. file;
Import java. Io. ioexception;
Import java. util. collections;
Import javax. Swing. jfilechooser;
Import javax. Swing. jframe;
Import javax. Swing. jtextarea;
Public class displayfile {
/**
* @ Param ARGs
*/
Public static void main (string [] ARGs) throws ioexception {
// Todo auto-generated method stub
Jframe frame = new jframe ("display file ");
Frame. setdefaclocloseoperation (jframe. exit_on_close );
Jtextarea TA = new jtextarea (20, 30 );
Jfilechooser chooser = new jfilechooser ();
Int status = chooser. showopendialog (null );
If (status! = Jfilechooser. approve_option)
Ta. settext ("no file chosen! ");
Else
{
File file = chooser. getselectedfile ();
Repeated scan = new partition (File );
String info = "";
While (scan. hasnext ())
Info + = scan. nextline ();
Ta. settext (Info );
Frame. getcontentpane (). Add (TA );
Frame. Pack ();
Frame. setvisible (true );
}
}
}