Hi i am having a problem getting this to work i want to add the user input input from the text field "Line 13" so i can add it to "newFile = new File("C:/Users/Administrator.Dan-HP/Desktop/" + input + ".txt");" but where i put input it doesn't work becuase it cant recognize input, if i remove input and just put hello.txt in "" thwn it runs but i need it be renamed by the user. any ideas? also they are both in two different class files ion the same package.
[code]
public class window extends JFrame{
public static JTextField textField;
public window(){
textField = new JTextField(20);
add(textField);
textField.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
String input = textField.getText();
}
});
}
}
public class fileCreation{
public static void files ()throws IOException{
File newFile;
newFile = new File("C:/Users/Administrator.Dan-HP/Desktop/" + input + ".txt");
if(!newFile.exists()){
newFile.createNewFile();
}
}
}