try
{
JFileChooser flcFile = new JFileChooser("c:/");
int rep = flcFile.showSaveDialog(this);
File filesave = flcFile.getSelectedFile();
if (rep == JFileChooser.APPROVE_OPTION)
{
try(FileWriter writer = new FileWriter(filesave))
{
//if(chkE.isSelected() == true){
//do stuff
}
writer.write(String.valueOf(txtNom1.getText()));
writer.write("\r\n");
writer.write(String.valueOf(txtPre1.getText()));
writer.write("\r\n");
writer.write(String.valueOf(optoui.getText()));
writer.write("\r\n");
writer.write(String.valueOf(optoui.getText()));
writer.write("\r\n");
writer.write(String.valueOf(optnon.getText()));
writer.write("\r\n");
writer.write(String.valueOf(chkanimaux.getText()));
writer.write("\r\n");
writer.write(String.valueOf(chkChauffer.getText()));
writer.write("\r\n");
writer.write(String.valueOf(chkE.getText()));
writer.write("\r\n");
writer.write(String.valueOf(txttel.getText()));
writer.write("\r\n");
writer.close();
}
}
}
catch(IOException err1)
{
}
my english isn't my first language.
hi, so i need to save information for my final project and i need one little thing for complet it.
my Question is, how i do to save selected checkbox or radio button in notepad?
i know how to save any String information but i dont know how to save the selected checkbox/radio button in my notepad so when i will open it back and it will select it automatically. i tried if(chkE.isSelected() == true) but i dont know what to write in for making it save into my notepad. thx in advance
Aucun commentaire:
Enregistrer un commentaire