Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JButton btnSubmit = new JButton("Submit");
- btnSubmit.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent arg0) {
- File EmployeeFile = new File("C:/Users/Nicol/Desktop/Employeesname.txt");
- if(!EmployeeFile.exists())
- {
- try
- {
- boolean HasBeenCreated = EmployeeFile.createNewFile();
- if(HasBeenCreated)
- {
- System.out.println("A new employee has been added succesfully! Their detail-file has been created on the desktop.");
- }
- else
- {
- System.out.println("An error occured. Employee's file has not been created.");
- }
- }
- catch (IOException ex)
- {
- ex.printStackTrace();
- }
- }
Add Comment
Please, Sign In to add comment