Notes
![]() ![]() Notes - notes.io |
import java.awt.event.ActionListener;
import java.sql.ResultSet;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
public class AddCustomer extends JFrame{
private JLabel labelCustomerName;
private JLabel labelEmail;
private JLabel labelPhone;
private JLabel labelAcctype;
private JLabel labelInitialDeposit;
private JLabel labelUsername;
private JLabel labelPassword;
private JTextField textCustomerName;
private JTextField textEmail;
private JTextField textPhone;
private JComboBox comboAcctype;
private JTextField textInitialDeposit;
private JTextField textUsername;
private JPasswordField textPassword;
private JButton buttonAdd;
private JPanel panel;
public AddCustomer() {
initializeComponents();
}
private void initializeComponents() {
panel = new JPanel();
panel.setLayout(null);
labelCustomerName = new JLabel("Customer Name:");
labelCustomerName.setBounds(30, 30, 150, 20);
panel.add(labelCustomerName);
labelEmail = new JLabel("Email:");
labelEmail.setBounds(30, 70, 150, 20);
panel.add(labelEmail);
labelPhone = new JLabel("Phone No:");
labelPhone.setBounds(30, 110, 150, 20);
panel.add(labelPhone);
labelAcctype = new JLabel("Account Type:");
labelAcctype.setBounds(30, 150, 150, 20);
panel.add(labelAcctype);
labelInitialDeposit = new JLabel("Initial Deposit:");
labelInitialDeposit.setBounds(30, 190, 150, 20);
panel.add(labelInitialDeposit);
labelUsername = new JLabel("Username:");
labelUsername.setBounds(30, 230, 150, 20);
panel.add(labelUsername);
labelPassword = new JLabel("Password:");
labelPassword.setBounds(30, 270, 150, 20);
panel.add(labelPassword);
textCustomerName = new JTextField();
textCustomerName.setBounds(200, 30, 150, 20);
panel.add(textCustomerName);
textEmail = new JTextField();
textEmail.setBounds(200, 70, 150, 20);
panel.add(textEmail);
textPhone = new JTextField();
textPhone.setBounds(200, 110, 150, 20);
panel.add(textPhone);
comboAcctype = new JComboBox(new String[]{"current","savings","fixed"});
comboAcctype.setBounds(200, 150, 150, 20);
panel.add(comboAcctype);
textInitialDeposit = new JTextField();
textInitialDeposit.setBounds(200, 190, 150, 20);
panel.add(textInitialDeposit);
textUsername = new JTextField();
textUsername.setBounds(200, 230, 150, 20);
panel.add(textUsername);
textPassword = new JPasswordField();
textPassword.setBounds(200, 270, 150, 20);
panel.add(textPassword);
buttonAdd = new JButton("Add");
buttonAdd.setBounds(150, 310,150, 20);
panel.add(buttonAdd);
buttonAdd.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
DataAccess da = new DataAccess();
String sql = "INSERT INTO users (user_name,password) VALUES("+AddCustomer.this.textUsername.getText()+","+AddCustomer.this.textPassword.getText()+")";
if(executeSQL(sql))
{
sql = "INSERT INTO customer (user_name,CUST_NAME,CUST_PHONE,CUST_MAIL) VALUES("+AddCustomer.this.textUsername.getText()+","+AddCustomer.this.labelCustomerName.getText()+","+AddCustomer.this.labelEmail.getText()+","+AddCustomer.this.labelPhone.getText()+")";
if(executeSQL(sql))
{
JOptionPane.showMessageDialog(null, "Done");
}
else
JOptionPane.showMessageDialog(null, "An error occured");
}
else
JOptionPane.showMessageDialog(null, "An error occured");
}
});
this.add(panel);
this.setSize(500, 400);
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team