public void mnuOpen_actionPerformed(ActionEvent e) {
fcSelect.showOpenDialog(this);
File file;
FileReader in=null;
try{
file=new File(fcSelect.getSelectedFile().getPath());
in=new FileReader(file);
int size=(int)file.length();
char[] data=new char[size];
int chars_read=0;
while(chars_read<size){
chars_read+=in.read(data,chars_read,size-chars_read);
}
txaDisplay.setText(new String(data));
}catch(Exception ie){
txaDisplay.setText(ie.getClass().getName()+":"+ie.getMessage());
}
finally{try{if(in!=null)in.close();}catch(IOException ie){}}
this.repaint();
}
}
fcSelect.showOpenDialog(this);
File file;
FileReader in=null;
try{
file=new File(fcSelect.getSelectedFile().getPath());
in=new FileReader(file);
int size=(int)file.length();
char[] data=new char[size];
int chars_read=0;
while(chars_read<size){
chars_read+=in.read(data,chars_read,size-chars_read);
}
txaDisplay.setText(new String(data));
}catch(Exception ie){
txaDisplay.setText(ie.getClass().getName()+":"+ie.getMessage());
}
finally{try{if(in!=null)in.close();}catch(IOException ie){}}
this.repaint();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货