-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_account.java
More file actions
76 lines (74 loc) · 2.08 KB
/
Copy pathuser_account.java
File metadata and controls
76 lines (74 loc) · 2.08 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
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package chemist_shop;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class user_account extends JFrame implements ActionListener
{
JTextField t1;
JPasswordField p1, p2;
JLabel l1, l2, l3;
JButton b1;
Font f1 = new Font("Courier New", Font.ITALIC,26);
public user_account()
{
setBackground(Color.pink);
setSize(1000,1000);
setLocation(200,200);
setLayout(new FlowLayout());
setFont(f1);
l1 = new JLabel("Username");
l2 = new JLabel("PAssword");
l3 = new JLabel("Confirm Password");
t1 = new JTextField(20);
p1 = new JPasswordField(20);
p2 = new JPasswordField(20);
l1.setFont(f1);
t1.setFont(f1);
l2.setFont(f1);
p1.setFont(f1);
l3.setFont(f1);
p2.setFont(f1);
add(l1);
add(t1);
add(l2);
add(p1);
add(l3);
add(p2);
b1 = new JButton("Submit");
add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
String q = "INSERT INTO LOGIN VALUES('"+t1.getText()+"', '"+p1.getText()+"')";
String one = p1.getText();
String two = p2.getText();
if(one.equals(two)==true)
{
try
{
conn c1 = new conn();
c1.s.executeUpdate(q);
JOptionPane.showMessageDialog(null, "New USer Account Created");
}
catch(Exception e)
{
e.printStackTrace();
}
}
if(one.equals(two)==false)
{
JOptionPane.showMessageDialog(null, "Passwords aren't equal");
}
}
public static void main(String s[])
{
new user_account().setVisible(true);
}
}