-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaddressHandler.java
More file actions
61 lines (48 loc) · 1.48 KB
/
addressHandler.java
File metadata and controls
61 lines (48 loc) · 1.48 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
59
60
61
import java.sql.*;
import javax.swing.*;
public class addressHandler {
//add lines to database
public void addLine(Connection con) {
}
//add data from a file to database
public void addDataFile(Connection con, File f) {
}
//delete lines from database
public void remove(Connection con) {
}
//retrieve lines from database
public void retrieve(Connection con) {
}
//edit an entry in the database
public void edit(Connection con) {
}
public static void main(String[] args) {
String url = "";
try {
Connection con = DriverManager.getConnection(url);
} catch (SQLException e) {
}
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
String title = "Address Handler";
String[] initialOptions = {"Add", "Delete", "Edit", "View"};
int choice = JOptionPane.showOptionDialog(frame, "Would you like to add, delete, edit, or view an entry?", title, JOptionPane.DEFAULT_OPTION,
JOptionPane.QUESTION_MESSAGE, null, initialOptions, initialOptions[0]);
String[] forms = {"Using a file", "Using the manual method"};
if (choice == 0) {
int form = JOptionPane.showOptionDialog(frame, "How would you like to add data?", title, JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
null, forms, forms[0]);
if (form == 0) {
addDataFile(con, File f);
} else {
addLine(con);
}
} else if (choice == 1) {
remove(con);
} else if (choice == 2) {
edit(con);
} else {
retrieve(con);
}
}
}