I’m having a problem here
I am using netbeans!
I am unable to use the .write
Here are my codes:
ModFile=new File(NameText.getText() + ".mod");
if(!ModFile.exists()){
try {
ModFile.createNewFile();
System.out.println("Mod file has been created to the current directory");
ModFile.*write*(CodesBox.getText());
} catch (IOException ex) {
Logger.getLogger(ModMakerGui.class.getName()).log(Level.SEVERE, null, ex);
}
}
This line:
ModFile.*write*(CodesBox.getText());
is giving me problems!
Please help me here
File does not have write method. Please use FileWriter or Print Writer
ModFile=new File(NameText.getText() + ".mod"); FileWriter writer=null; if(!ModFile.exists()){ try { ModFile.createNewFile(); writer=new FileWriter(ModFile); System.out.println("Mod file has been created to the current directory"); writer.write(CodesBox.getText()); } catch (IOException ex) { Logger.getLogger(ModMakerGui.class.getName()).log(Level.SEVERE, null, ex); } }