Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 javaapplication1;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- import java.sql.Statement;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import javax.swing.JFrame;
- import java.sql.DriverManager;
- import java.sql.ResultSet;
- import javax.swing.JOptionPane;
- /**
- *
- * @author husse
- */
- public class RegistratieScherm extends javax.swing.JFrame {
- private static final String USERNAME= "root";
- private static final String PASSWORD= "";
- private static final String CONN_STRING= "jdbc:mysql://localhost:3306/diaconnect";
- /**
- * Creates new form RegistratieScherm
- */
- public RegistratieScherm() {
- initComponents();
- this.setLocationRelativeTo(null); //scherm komt in het midden bij run
- }
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings("unchecked")
- // <editor-fold defaultstate="collapsed" desc="Generated Code">
- private void initComponents() {
- filler1 = new javax.swing.Box.Filler(new java.awt.Dimension(0, 0), new java.awt.Dimension(0, 0), new java.awt.Dimension(32767, 32767));
- jTextField3 = new javax.swing.JTextField();
- jTextField5 = new javax.swing.JTextField();
- jTextField8 = new javax.swing.JTextField();
- jPanel2 = new javax.swing.JPanel();
- jLabel1 = new javax.swing.JLabel();
- jTextField1 = new javax.swing.JTextField();
- jLabel2 = new javax.swing.JLabel();
- jLabel3 = new javax.swing.JLabel();
- jButton1 = new javax.swing.JButton();
- jLabel4 = new javax.swing.JLabel();
- jLabel6 = new javax.swing.JLabel();
- jPasswordField3 = new javax.swing.JPasswordField();
- jPasswordField4 = new javax.swing.JPasswordField();
- jLabel7 = new javax.swing.JLabel();
- jLabel8 = new javax.swing.JLabel();
- jLabel9 = new javax.swing.JLabel();
- jLabel10 = new javax.swing.JLabel();
- jLabel11 = new javax.swing.JLabel();
- jTextField2 = new javax.swing.JTextField();
- jTextField4 = new javax.swing.JTextField();
- jTextField6 = new javax.swing.JTextField();
- jTextField7 = new javax.swing.JTextField();
- jTextField9 = new javax.swing.JTextField();
- jTextField3.setBackground(new java.awt.Color(164, 176, 190));
- jTextField3.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField3ActionPerformed(evt);
- }
- });
- jTextField5.setBackground(new java.awt.Color(164, 176, 190));
- jTextField5.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField5ActionPerformed(evt);
- }
- });
- jTextField8.setBackground(new java.awt.Color(164, 176, 190));
- jTextField8.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField8ActionPerformed(evt);
- }
- });
- setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
- jPanel2.setBackground(new java.awt.Color(87, 96, 111));
- jPanel2.setPreferredSize(new java.awt.Dimension(578, 527));
- jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/javaapplication1/images/diatech logo_1.png"))); // NOI18N
- jLabel1.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
- jLabel1.setMaximumSize(new java.awt.Dimension(67, 31));
- jLabel1.setName(""); // NOI18N
- jLabel1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
- jTextField1.setBackground(new java.awt.Color(164, 176, 190));
- jTextField1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField1ActionPerformed(evt);
- }
- });
- jLabel2.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel2.setForeground(new java.awt.Color(255, 255, 255));
- jLabel2.setText("Gebruikersnaam:");
- jLabel3.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel3.setForeground(new java.awt.Color(255, 255, 255));
- jLabel3.setText("Volle naam:");
- jButton1.setBackground(new java.awt.Color(186, 220, 88));
- jButton1.setText("Log in");
- jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- jButton1MouseClicked(evt);
- }
- });
- jButton1.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jButton1ActionPerformed(evt);
- }
- });
- jLabel4.setForeground(new java.awt.Color(255, 255, 255));
- jLabel4.setText("Already have an account? Log in!");
- jLabel4.addMouseListener(new java.awt.event.MouseAdapter() {
- public void mouseClicked(java.awt.event.MouseEvent evt) {
- jLabel4MouseClicked(evt);
- }
- });
- jLabel6.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel6.setForeground(new java.awt.Color(255, 255, 255));
- jLabel6.setText("Wachtwoord:");
- jPasswordField3.setBackground(new java.awt.Color(164, 176, 190));
- jPasswordField4.setBackground(new java.awt.Color(164, 176, 190));
- jLabel7.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel7.setForeground(new java.awt.Color(255, 255, 255));
- jLabel7.setText("Her-Wachtwoord:");
- jLabel8.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel8.setForeground(new java.awt.Color(255, 255, 255));
- jLabel8.setText("Emailadres:");
- jLabel9.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel9.setForeground(new java.awt.Color(255, 255, 255));
- jLabel9.setText("Telefoonnummer:");
- jLabel10.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel10.setForeground(new java.awt.Color(255, 255, 255));
- jLabel10.setText("Geboortedatum:");
- jLabel11.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
- jLabel11.setForeground(new java.awt.Color(255, 255, 255));
- jLabel11.setText("BSN-nummer:");
- jTextField2.setBackground(new java.awt.Color(164, 176, 190));
- jTextField2.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField2ActionPerformed(evt);
- }
- });
- jTextField4.setBackground(new java.awt.Color(164, 176, 190));
- jTextField4.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField4ActionPerformed(evt);
- }
- });
- jTextField6.setBackground(new java.awt.Color(164, 176, 190));
- jTextField6.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField6ActionPerformed(evt);
- }
- });
- jTextField7.setBackground(new java.awt.Color(164, 176, 190));
- jTextField7.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField7ActionPerformed(evt);
- }
- });
- jTextField9.setBackground(new java.awt.Color(164, 176, 190));
- jTextField9.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- jTextField9ActionPerformed(evt);
- }
- });
- javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
- jPanel2.setLayout(jPanel2Layout);
- jPanel2Layout.setHorizontalGroup(
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(134, 134, 134)
- .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(106, 106, 106)
- .addComponent(jLabel4)))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jPasswordField4, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(jLabel6)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel2, javax.swing.GroupLayout.Alignment.TRAILING))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jLabel10)
- .addComponent(jLabel8)
- .addComponent(jLabel9))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addComponent(jLabel11)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE))))
- .addGap(254, 254, 254))
- );
- jPanel2Layout.setVerticalGroup(
- jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(15, 15, 15)
- .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(jLabel2))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel3)
- .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jLabel6)
- .addComponent(jPasswordField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addGap(15, 15, 15)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
- .addComponent(jPasswordField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGroup(jPanel2Layout.createSequentialGroup()
- .addGap(2, 2, 2)
- .addComponent(jLabel7, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel8)
- .addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel9)
- .addComponent(jTextField7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel10)
- .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(jLabel11)
- .addComponent(jTextField9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 34, Short.MAX_VALUE)
- .addComponent(jButton1)
- .addGap(30, 30, 30)
- .addComponent(jLabel4))
- );
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 400, Short.MAX_VALUE)
- );
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
- );
- pack();
- }// </editor-fold>
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- Connection conn = null;
- String a = jTextField1.getText(); //voornaam
- String b = jTextField2.getText(); //achternaam
- String c = jPasswordField3.getText(); //wachtwoord
- String d = jPasswordField4.getText(); //her-wachtwoord
- String e = jTextField6.getText(); //emailadres
- String f = jTextField7.getText(); //telefoonnummer
- String g = jTextField4.getText(); //geboortedatum
- String h = jTextField9.getText(); //BSN-nummer
- try {
- conn = DriverManager.getConnection(CONN_STRING,USERNAME,PASSWORD);
- System.out.println("registered");
- //Dialog.setVisible(true);
- Statement stmt = (Statement) conn.createStatement();
- String insert = "INSERT INTO `registraties` (`Gebruikersnaam`, `Volle naam`, `Password`, `RePassword`, `Emailadres`, `Telefoonnummer`, `Geboortedatum`, `BSN`) VALUES ('"+a+"', '"+b+"', '"+c+"', '"+d+"', '"+e+"', '"+f+"', '"+g+"', '"+h+"')";
- stmt.executeUpdate(insert);
- if (a.isEmpty() || b.isEmpty() || c.isEmpty() || d.isEmpty() || e.isEmpty() || f.isEmpty() || g.isEmpty() || h.isEmpty())
- {
- JOptionPane.showMessageDialog(this,"Complete All The Fields");
- }
- else {
- JOptionPane.showMessageDialog(this,"Registered Succesfully");
- this.dispose();
- new Loginscherm().setVisible(true);
- }
- }
- catch (SQLException ee) {
- System.err.println(ee);
- }
- }
- private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- String deNaam = "";
- if(deNaam.equals("")) {
- System.out.println("hi");
- }
- }
- private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jTextField3ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jTextField4ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jTextField5ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jTextField6ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jTextField7ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jTextField8ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jTextField9ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- }
- private void jLabel4MouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- this.dispose();
- new Loginscherm().setVisible(true);
- }
- private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
- // TODO add your handling code here:
- }
- /**
- * @param args the command line arguments
- */
- public static void main(String args[]) {
- /* Set the Nimbus look and feel */
- //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
- /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
- * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
- */
- try {
- for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
- if ("Nimbus".equals(info.getName())) {
- javax.swing.UIManager.setLookAndFeel(info.getClassName());
- break;
- }
- }
- } catch (ClassNotFoundException ex) {
- java.util.logging.Logger.getLogger(RegistratieScherm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (InstantiationException ex) {
- java.util.logging.Logger.getLogger(RegistratieScherm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (IllegalAccessException ex) {
- java.util.logging.Logger.getLogger(RegistratieScherm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- } catch (javax.swing.UnsupportedLookAndFeelException ex) {
- java.util.logging.Logger.getLogger(RegistratieScherm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
- }
- //</editor-fold>
- /* Create and display the form */
- java.awt.EventQueue.invokeLater(new Runnable() {
- public void run() {
- new RegistratieScherm().setVisible(true);
- }
- });
- }
- // Variables declaration - do not modify
- private javax.swing.Box.Filler filler1;
- private javax.swing.JButton jButton1;
- private javax.swing.JLabel jLabel1;
- private javax.swing.JLabel jLabel10;
- private javax.swing.JLabel jLabel11;
- private javax.swing.JLabel jLabel2;
- private javax.swing.JLabel jLabel3;
- private javax.swing.JLabel jLabel4;
- private javax.swing.JLabel jLabel6;
- private javax.swing.JLabel jLabel7;
- private javax.swing.JLabel jLabel8;
- private javax.swing.JLabel jLabel9;
- private javax.swing.JPanel jPanel2;
- private javax.swing.JPasswordField jPasswordField3;
- private javax.swing.JPasswordField jPasswordField4;
- private javax.swing.JTextField jTextField1;
- private javax.swing.JTextField jTextField2;
- private javax.swing.JTextField jTextField3;
- private javax.swing.JTextField jTextField4;
- private javax.swing.JTextField jTextField5;
- private javax.swing.JTextField jTextField6;
- private javax.swing.JTextField jTextField7;
- private javax.swing.JTextField jTextField8;
- private javax.swing.JTextField jTextField9;
- // End of variables declaration
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement