I have a showInputDialog. Whenever I type something to that field, I want it to be save as textfile when I click the ok button. My problem is I don't know where/how to put the listener.
Could somebody help me about this matter?
The saving code shouldn't be in the InputDialog
context, but in your code. InputDialog
is just a way to prompt for data.
String whatHeTyped = JOptionPane.showInputDialog("Type something...");
saveToFile(whatHeTyped);