-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectoryNotFoundException.java
More file actions
43 lines (40 loc) · 1.46 KB
/
DirectoryNotFoundException.java
File metadata and controls
43 lines (40 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package file_organizer_gui;
import java.awt.Color;
import java.awt.Font;
import java.nio.file.Path;
import javax.swing.JFrame;
import javax.swing.JTextArea;
/**
* @author Joshua Lamke
* Exception that is thrown when the inputed path does not exist inside of the file system
*/
@SuppressWarnings("serial")
public class DirectoryNotFoundException extends Exception{
private String message;
private String pathName;
private JFrame popUp;
private JTextArea buttonForException;
/**
* @author Joshua Lamke
* @param p The directory to be verified
*/
public DirectoryNotFoundException(Path p) {
pathName=p.toString();
message = "Unable to find the Directory/File named:\n\"" + pathName + "\"\nPlease check the spelling or click\nthe help button for more information\non how to register a path.";
popUp = new JFrame("Directory Not Found");
popUp.getContentPane().setBackground(Color.WHITE);
popUp.setBounds(500, 500, 500, 200);
popUp.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
popUp.getContentPane().setLayout(null);
buttonForException = new JTextArea(message);
buttonForException.setFont(new Font("Times New Roman",Font.BOLD,24));
buttonForException.setBounds((int)popUp.getAlignmentX()/2, (int)popUp.getAlignmentY(), 500, 300);
popUp.getContentPane().add(buttonForException);
}
/**
* sets the DirectoryNotFoundExcpetion's error message pop up to be visible
*/
public void getExceptionPopUp() {
popUp.setVisible(true);
}
}