-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectFile.java
More file actions
104 lines (86 loc) · 2.81 KB
/
ObjectFile.java
File metadata and controls
104 lines (86 loc) · 2.81 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package bootathonfinal;
import java.awt.Color;
import java.awt.Font;
import java.sql.*;
import java.util.regex.Pattern;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
public class ObjectFile {
private static Connection con;
public static JFrame getFrame(String name) {
JFrame frame = new JFrame(name);
frame.setSize(1000, 700);
frame.setLocationRelativeTo(null);
frame.setLayout(null);
frame.getContentPane().setBackground(Color.decode("#f6f1f1"));
frame.setVisible(true);
//sframe.setResizable(false);
return frame;
}
public static JButton getButton(String name) {
JButton b1 = new JButton(name);
b1.setFont(new Font("Garamond", Font.BOLD+Font.ITALIC,22));
b1.setForeground(Color.white);
b1.setBackground(Color.decode("#5424BA"));
//Border border = new LineBorder(Color.decode("#ff69b4"), 2, false);
b1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseEntered(java.awt.event.MouseEvent evt) {
// b1.setBackground(Color.decode("#ff69b4"));
//b1.setForeground(Color.BLACK);
// Border border1 = new LineBorder(Color.white, 2, false);
//b1.setBorder(border1);
}
public void mouseExited(java.awt.event.MouseEvent evt) {
//b1.setBackground(Color.white);
//b1.setForeground(Color.BLACK);
//Border border1 = new LineBorder(Color.decode("#ff69b4"), 2, false);
// b1.setBorder(border1);
}
});
//b1.setBorder(border);
return b1;
}
public static Connection getjdbc() {
try {
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost/CarePlus", "root","password");
return con;
//Statement stmt = con.createStatement();
} catch (Exception e) {
// TODO Auto-generated catch block
System.out.println(e);
}
return null;
}
public static JTextField gettext() {
JTextField text = new JTextField();
return text;
}
public static JPanel getpanel()
{
JPanel panel = new JPanel();
panel.setSize(350,700);
panel.setBackground(Color.decode("#5424BA"));
return panel;
}
public static boolean regex(String hospitalName, String phoneNumber) {
boolean Name = Pattern.matches("[a-zA-Z\\s]{2,20}", hospitalName);
boolean Number = Pattern.matches("[0-9]{10}", phoneNumber);
if (Name && Number ) {
return true;
} else {
return false;
}
}
public static boolean regex1(String u)
{
boolean l=Pattern.matches("^[a-zA-Z0-9]{4}", u);
return l;
}
public static boolean password_regex(String password) {
String regex ="^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=_*])(?=\\S+$).{6,15}$";
boolean res = Pattern.matches(regex, password);
return res;
}
}