Mehmet Ethem SULAN :: Çevik Yazılım ile Javada Proje Geliştirme :: Aşırı Programlama(Extreme Programming) ile Java Uygulaması
package www.ethemsulan.com;
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JButton;
import UyeKayitGerceklestirmeUyg.UyeKayitGerceklestirmeUyg;
public class UyeKayitGerceklestirme extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JTextField jTextField = null;
private JLabel jLabel1 = null;
private JTextField jTextField1 = null;
private JLabel jLabel2 = null;
private JTextField jTextField2 = null;
private JLabel jLabel3 = null;
private JTextField jTextField3 = null;
private JLabel jLabel4 = null;
private JPasswordField jPasswordField = null;
private JLabel jLabel5 = null;
private JPasswordField jPasswordField1 = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(117, 27, 139, 20));
  }
  return jTextField;
  }
private JTextField getJTextField1() {

< pre style="background-color:#ffffff;width:100%;font-family:consolas,'Courier New',courier,monospace;font-size:12px;margin:0;">if (jTextField1 == null) {

jTextField1 = new JTextField();
jTextField1.setBounds(new Rectangle(118, 73, 139, 20));
    }
    return jTextField1;
  }
private JTextField getJTextField2() {
  if (jTextField2 == null) {
jTextField2 = new JTextField();
jTextField2.setBounds(new Rectangle(117, 121, 136, 20));
    }
    return jTextField2;
  }
private JTextField getJTextField3() {
  if (jTextField3 == null) {
  jTextField3 = new JTextField();
jTextField3.setBounds(new Rectangle(117, 170, 142, 20));
    }
    return jTextField3;
  }

private JPasswordField getJPasswordField() {
  if (jPasswordField == null) {
jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(120, 219, 138, 20));
    }
    return jPasswordField;
  }
private JPasswordField getJPasswordField1() {
  if (jPasswordField1 == null) {
  jPasswordField1 = new JPasswordField();
jPasswordField1.setBounds(new Rectangle(122, 267, 136, 20));
    }
    return jPasswordField1;
  }
private JButton getJButton() {
if (jButton == null) {
  jButton = new JButton();
jButton.setBounds(new Rectangle(57, 329, 109, 28));
jButton.setText("Kaydet");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
String tcG=jTextField.getText().trim();
String adG=jTextField1.getText().trim();
String soyadG=jTextField2.getText().trim();
String emailG=jTextField3.getText().trim();
String parolaG=jPasswordField.getText().trim();
String basarilimi="Kayit basarisiz";
int emailParcalama=0;
String[] dizi=emailG.split("@|\.");
for (String string : dizi) {
  emailParcalama++;
  }
//"" yanı boş girilirse uyarı verir.
if("".equals(tcG) | "".equals(adG) | "".equals(soyadG) | 
"".equals(emailG) | "".equals(parolaG) | "".equals(jPasswordField1))
{
JOptionPane.showMessageDialog(null, "Alanlar bos gecilemez");
    }
else if(!parolaG.equals(jPasswordField1.getText().trim())){
JOptionPane.showMessageDialog(null, "parolalar ayni degil");
}else if(emailParcalama<3){
JOptionPane.showMessageDialog(null, "email@email.com seklinde girmediniz");
}else if(tcG.length()!=11){
JOptionPane.showMessageDialog(null, "TC Kimlik no 11 rakamdan olsur");
}else{
basarilimi=obj.uyeKayitGerceklestir(tcG, adG, soyadG, emailG, parolaG);
if(basarilimi.trim().equals("Basarili")){
JOptionPane.showMessageDialog(null, "Kayit basariyla gerceklesti");
//kayıt başarılı olduğunda alanları sıfırlıyor(null)
jTextField.setText(null);
jTextField1.setText(null);
jTextField2.setText(null);
jTextField3.setText(null);
jPasswordField.setText(null);
jPasswordField1.setText(null);
}else{
JOptionPane.showMessageDialog(null, "Kayit gerceklestirilemedi");
        }
      }
      }
    });
    }
    return jButton;
  }
private JButton getJButton1() {
  if (jButton1 == null) {
  jButton1 = new JButton();
jButton1.setBounds(new Rectangle(203, 332, 101, 26));
  jButton1.setText("Kapat");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
  setVisible(false);
  AnaSayfa cagir=new AnaSayfa();
  cagir.setVisible(true);
        }
      });
    }
    return jButton1;
  }
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
UyeKayitGerceklestirme thisClass =
  new UyeKayitGerceklestirme();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
      }
    });
  }
UyeKayitGerceklestirmeUyg obj;
public UyeKayitGerceklestirme() {
    super();
    initialize();
obj=new UyeKayitGerceklestirmeUyg();
  }
private void initialize() {
this.setSize(410, 427);
this.setContentPane(getJContentPane());
this.setTitle("Uye Bilgilerini Kaydet");
  }
private JPanel getJContentPane() {

< pre style="background-color:#ffffff;width:100%;font-family:consolas,'Courier New',courier,monospace;font-size:12px;margin:0;">if (jContentPane == null) {

jLabel5 = new JLabel();
jLabel5.setBounds(new Rectangle(10, 269, 83, 16));
jLabel5.setText("Parola Tekrar:");
jLabel4 = new JLabel();
jLabel4.setBounds(new Rectangle(14, 216, 76, 16));
jLabel4.setText("Parola:");
jLabel3 = new JLabel();
jLabel3.setBounds(new Rectangle(16, 166, 79, 16));
jLabel3.setText("E-mail:");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(18, 127, 72, 16));
jLabel2.setText("Kul Soyad:");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(19, 75, 72, 16));
jLabel1.setText("Kul Adi:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(19, 22, 71, 16));
jLabel.setText("TcNo:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(jLabel1, null);
jContentPane.add(getJTextField1(), null);
jContentPane.add(jLabel2, null);
jContentPane.add(getJTextField2(), null);
jContentPane.add(jLabel3, null);
jContentPane.add(getJTextField3(), null);
jContentPane.add(jLabel4, null);
jContentPane.add(getJPasswordField(), null);
jContentPane.add(jLabel5, null);
jContentPane.add(getJPasswordField1(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton1(), null);
    }
    return jContentPane;
  }
} 

Write a Comment

Let me know what you think?