-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPathPrompt.java
More file actions
58 lines (51 loc) · 1.7 KB
/
Copy pathPathPrompt.java
File metadata and controls
58 lines (51 loc) · 1.7 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
Brent Thompson
CEN 3024C 15339 Software Development 1
Professor Ashley Evans
November 12th, 2024
Module 10 - Integrate Database
This class is used to prompt the user for a filepath to either load or create a database. The information is needed to
run the solar database app.
*/
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* @author Brent Thompson
* @version 1.0
*/
public class PathPrompt extends JFrame {
public JTextField filePath;
public JPanel PathPrompt;
public JButton addDatabase;
/**
* @see SolarDatabaseMenu for more details on how this class is used.
*/
public PathPrompt() {
setContentPane(PathPrompt);
setTitle("Solar Database Filepath");
setSize(1000, 600);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
addDatabase.addActionListener(new ActionListener() {
/**
* @param e Collect a filepath to be used in the solar panel database
*/
@Override
public void actionPerformed(ActionEvent e) {
String filename = "";
try {
filename = filePath.getText();
}
catch (Exception ex) {
ex.printStackTrace();
}
while (filename.equals("")) {
JOptionPane.showMessageDialog(PathPrompt, "Please enter a file name");
break;}
filename = filePath.getText();
SolarDatabaseMenu frame = new SolarDatabaseMenu(filename);
}
});
}
}