Archive for the ‘ Çevik Yazılım ile Javada Proje Geliştirme ’ Category

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 java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.JTextArea;
import BiletSatmaSayfasiUyg.BiletSatmaSayfasiUyg;
public class BiletSatmaSayfasi extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JTextField jTextField = null;
private JButton jButton = null;
private JTextArea jTextArea = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JTextField getJTextField() {
if (jTextField == null) {
jTextField = new JTextField();
jTextField.setBounds(new Rectangle(108, 16, 135, 20));
  }
  return jTextField;
}
//Bu metod cok bagimli oldugundan test etmek iyi degil.
//Amacimiz %100 test etmektir ama bazi metodlari test edemeyiz.
  Connection baglanti=null;
  Statement uygula = null;
  String uNo=null;
  private JButton getJButton() {
    if (jButton == null) {
      jButton = new JButton();
jButton.setBounds(new Rectangle(101, 74, 100, 30));
  jButton.setText("Sorgula");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
  uNo=jTextField.getText().trim();
  if("".equals(uNo) | uNo==null){
JOptionPane.showMessageDialog(null, "Sorgulanacak Ucus Numarasini Giriniz");
  }else{
  try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e1) {
  e1.printStackTrace();
        }
    try {
baglanti = DriverManager.getConnection("jdbc:mysql://" +
    "localhost/cevikyazilim", "root","123");
    } catch (SQLException e1) {
    e1.printStackTrace();
      }
    try {
uygula = baglanti.createStatement();
  } catch (SQLException e1) {
  e1.printStackTrace();
    }
  ResultSet sonucGoster = null;
  try {
sonucGoster = uygula.executeQuery(
"select * from bilet where ucusno='"+uNo+"' ");
} catch (SQLException e1) {
  e1.printStackTrace();
    }
  try {
while (sonucGoster.next()) {
jTextArea.setText(sonucGoster.getString(1)+"\t"+
sonucGoster.getString(2)+"\t"+sonucGoster.getString(3)+"\n"
+sonucGoster.getString(4)+"\t"+sonucGoster.getString(5)+"\t"
+sonucGoster.getString(6)+"\n"+sonucGoster.getString(7)+"\t"
+String.valueOf(sonucGoster.getInt(8))+"\t"+
String.valueOf(sonucGoster.getInt(9)));
  }
  } catch (SQLException e1) {
  e1.printStackTrace();
    }
if(jTextArea.getText().isEmpty()){
JOptionPane.showMessageDialog(null, "Girdiginiz Ucus no Yanlis");
      }
    }
  }
});
}
return jButton;
}
private JTextArea getJTextArea() {
if (jTextArea == null) {
jTextArea = new JTextArea();
jTextArea.setBounds(new Rectangle(35, 144, 251, 72));
  }
  return jTextArea;
  }
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setBounds(new Rectangle(223, 274, 82, 27));
jButton2.setText("kapat");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
  setVisible(false);
  bil.setVisible(true);
        }
      });
    }
    return jButton2;
  }
private JButton getJButton1() {
  if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setBounds(new Rectangle(15, 272, 183, 34));
jButton1.setText("Satma Islemini Tamamla");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.Acti
onEvent e) {
  sat.biletSil(uNo);
JOptionPane.showMessageDialog(null, "Satma islemi basariyla gerceklesti");
  setVisible(false);
  bil.setVisible(true);
        }
      });
    }
    return jButton1;
  }
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
  public void run() {
BiletSatmaSayfasi thisClass = new BiletSatmaSayfasi();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  thisClass.setVisible(true);
    }
  });
}
BiletSatmaSayfasiUyg sat;
public BiletSatmaSayfasi() {
  super();
  initialize();
sat=new BiletSatmaSayfasiUyg();
}
BiletleriGorSatilmayan bil;
private void initialize() {
bil=new BiletleriGorSatilmayan();
this.setSize(358, 404);
this.setContentPane(getJContentPane());
this.setTitle("Bilet Satma Islemini Gerceklestir");
  }
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(17, 19, 69, 16));
jLabel.setText("Ucus No:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJTextArea(), null);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton2(), null);
    }
    return jContentPane;
  }

}
package www.ethemsulan.com;
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Rectangle;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JLabel;
public class BiletleriGorSatilmayan extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton jButton = null;
private JScrollPane jScrollPane = null;
Object [][] veriler;
Object[] kolonIsmi;
Connection baglanti=null;
private JLabel jLabel = null;
private JLabel jLabel1 = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JLabel jLabel5 = null;
private JLabel jLabel6 = null;
private JLabel jLabel7 = null;
private JLabel jLabel8 = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JButton getJButton() {
if (jButton == null) {
  jButton = new JButton();
jButton.setBound
s(new Rectangle(222, 305, 116, 36));
jButton.setText("Sorgula");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
  int sayac=0;
 veriler=new Object[50][9];
kolonIsmi=new Object[]{"Ucus No","Nereden","Nereye","Tarih",
"Kalkis Zamani","Varis Zamani","Hava Yolu","Ucret","Koltuk Numarasi"};
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e1) {
  e1.printStackTrace();
    }
  try {
baglanti = DriverManager.getConnection("jdbc:mysql://" +
    "localhost/cevikyazilim", "root","123");
  } catch (SQLException e1) {
  e1.printStackTrace();
    }
Statement uygula = null;
  try {
uygula = baglanti.createStatement();
  } catch (SQLException e1) {
    e1.printStackTrace();
    }
ResultSet sonuc = null;
  try {
sonuc = uygula.executeQuery("select * from bilet");
    } catch (SQLException e1) {
  e1.printStackTrace();
    }
    try {
  while (sonuc.next()) {
for (int i = 1; i <=kolonIsmi.length; i++) {
 veriler[sayac][i-1]=sonuc.getString(i);
    }
    sayac++;
    }
JTable tablo=new JTable(veriler,kolonIsmi);
  tablo.setBounds(0, 0, 779, 240);
  jScrollPane.add(tablo);
  jScrollPane.revalidate();
  } catch (SQLException e1) {
    e1.printStackTrace();
      }
      }
    });
    }
    return jButton;
  }
private JScrollPane getJScrollPane() {
if (jScrollPane == null) {
  jScrollPane = new JScrollPane();
jScrollPane.setBounds(new Rectangle(16, 33, 779, 240));
  }
  return jScrollPane;
}
private JButton getJButton1() {
if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setBounds(new Rectangle(649, 300, 140, 32));
jButton1.setText("Kapat");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
  setVisible(false);
  BiletIslemleri cagir=new BiletIslemleri();
  cagir.setVisible(true);
      }
    });
  }
  return jButton1;
}
private JButton getJButton2() {
if (jButton2 == null) {
jButton2 = new JButton();
jButton2.setBounds(new Rectangle(425, 305, 115, 29));
jButton2.setText("Bilet Sat");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
BiletSatmaSayfasi bilSat=new BiletSatmaSayfasi();
  bilSat.setVisible(true);
  setVisible(false);
      }
    });
  }
  return jButton2;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
BiletleriGorSatilmayan thisClass = new BiletleriGorSatilmayan();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
    }
  });
}
public BiletleriGorSatilmayan() {
    super();
    initialize();
  }
private void initialize() {
  this.setSize(842, 398);
this.setContentPane(getJContentPane());
this.setTitle("Satilmayan Biletler Musteri Bul");
  }
private JPanel getJContentPane() {
  if (jContentPane == null) {
  jLabel8 = new JLabel();
jLabel8.setBounds(new Rectangle(703, 15, 61, 16));
jLabel8.setText("Koltuk No");
jLabel7 = new JLabel();
jLabel7.setBounds(new Rectangle(630, 17, 47, 16));
jLabel7.setText("Ucret");
jLabel6 = new JLabel();
jLabel6.setBounds(new Rectangle(545, 16, 65, 16));
jLabel6.setText("Hava Yolu");
jLabel5 = new JLabel();
jLabel5.setBounds(new Rectangle(451, 14, 80, 16));
jLabel5.setText("Varis Zamani");
jLabel4 = new JLabel();
jLabel4.setBounds(new Rectangle(362, 14, 80, 16));
jLabel4.setText("Kalkis Zamani");
jLabel3 = new JLabel();
jLabel3.setBounds(new Rectangle(286, 14, 44, 16));
jLabel3.setText("Tarih");

jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(198, 13, 48, 16));
jLabel2.setText("Nereye");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(107, 13, 58, 16));
jLabel1.setText("Nereden");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(20, 9, 51, 16));
jLabel.setText("Ucus No");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJScrollPane(), null);
jContentPane.add(jLabel, null);
jContentPane.add(jLabel1, null);
jContentPane.add(jLabel2, null);
jContentPane.add(jLabel3, null);
jContentPane.add(jLabel4, null);
jContentPane.add(jLabel5, null);
jContentPane.add(jLabel6, null);
jContentPane.add(jLabel7, null);
jContentPane.add(jLabel8, null);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton2(), null);
}
return jContentPane;
 }
}
package www.ethemsulan.com;
import javax.swing.SwingUtilities;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.Rectangle;
import javax.swing.JTextField;
import javax.swing.JButton;
import BiletGuncelleUyg.BiletGuncelleUyg;
import BiletGuncelleUyg.GuncIslemiParameter;
public class BiletiGuncelle extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
JTextField jTextField = null;
private JLabel jLabel1 = null;
JTextField jTextField1 = null;
private JLabel jLabel2 = null;
JTextField jTextField2 = null;
private JLabel jLabel3 = null;
JTextField jTextField3 = null;
private JLabel jLabel4 = null;
JTextField jTextField4 = null;
private JLabel jLabel5 = null;
JTextField jTextField5 = null;
private JLabel jLabel6 = null;
JTextField jTextField6 = null;
private JLabel jLabel7 = null;
JTextField jTextField7 = null;
private JLabel jLabel8 = null;
 JTextField jTextField8 = null;
private JButton jButton = null;
private JTextField getJTextField() {
if (jTextField == null) {
 jTextField = new JTextField();
jTextField.setBounds(new Rectangle(125, 13, 135, 20));
 }
 return jTextField;
}
private JTextField getJTextField1() {
if (jTextField1 == null) {
jTextField1 = new JTextField();
jTextField1.setBounds(new Rectangle(121, 55, 140, 20));
 }
 return jTextField1;
}
private JTextField getJTextField2() {
if (jTextField2 == null) {
jTextField2 = new JTextField();
jTextField2.setBounds(new Rectangle(121, 100, 139, 20));
 }
 return jTextField2;
}
private JTextField getJTextField3() {
if (jTextField3 == null) {
jTextField3 = new JTextField();
jTextField3.setBounds(new Rectangle(120, 136, 136, 20));
 }
 return jTextField3;
}
private JTextField getJTextField4() {
if (jTextField4 == null) {
 jTextField4 = new JTextField();
jTextField4.setBounds(new Rectangle(118, 181, 135, 20));
 }
 return jTextField4;
 }

private JTextField getJTextField5() {
if (jTextField5 == null) {
 jTextField5 = new JTextField();
jTextField5.setBounds(new Rectangle(118, 221, 133, 20));
 }
 return jTextField5;
}
private JTextField getJTextField6() {
if (jTextField6 == null) {
 jTextField6 = new JTextField();
jTextField6.setBounds(new Rectangle(122, 261, 135, 20));
 }
 return jTextField6;
}
private JTextField getJTextField7() {
 if (jTextField7 == null) {
 jTextField7 = new JTextField();
jTextField7.setBounds(new Rectangle(121, 299, 131, 20));
 }
 return jTextField7;
 }
private JTextField getJTextField8() {
 if (jTextField8 == null) {
 jTextField8 = new JTextField();
jTextField8.setBounds(new Rectangle(125, 335, 127, 20));
 }
 return jTextField8;
 }
private JLabel jLabel9 = null;
private JButton jButton1 = null;
private JButton getJButton() {
 if (jButton == null) {
 jButton = new JButton();
jButton.setBounds(new Rectangle(77, 386, 90, 28));
 jButton.setText("Guncelle");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
 String uNo=jTextField.getText().trim();
String uNereden=jTextField1.getText().trim();
String uNereye=jTextField2.getText().trim();
String uTarih=jTextField3.getText().trim();
String uSaatKalkis=jTextField4.getText().trim();
String uSaatVaris=jTextField5.getText().trim();
String uHavaYolu=jTextField6.getText().trim();
 int uFiyat=0;
 int uKoltukNo = 0;
if("".equals(jTextField7.getText().trim())|
 "".equals(jTextField8.getText().trim()))
{
JOptionPane.showMessageDialog(null, "Ucret ya da fiyat alani bos gecilemez");
}else{
uFiyat=Integer.parseInt(jTextField7.getText().trim());
uKoltukNo=Integer.parseInt(jTextField8.getText().trim());
 }
if("".equals(uNo) | "".equals(uNereye) | "".equals(uNereden)
| "".equals(uTarih) | "".equals(uSaatKalkis) | "".equals(
uSaatVaris) | "".equals(uHavaYolu) | "".equals(jTextField5.
getText().trim()) | "".equals(jTextField6.getText().trim()))
{
JOptionPane.showMessageDialog(null, "Alanlar bos gecilemez");
}else{
if(bilGunc.guncIslemi(new GuncIslemiParameter(uNo, uNereden,
 uNereye, uTarih,uSaatKalkis, uSaatVaris, uHavaYolu,
 uFiyat, uKoltukNo)))
{
JOptionPane.showMessageDialog(null, "Bilet basariyla guncelelndi");
}else{
JOptionPane.showMessageDialog(null, "Yanlis ucus numarasi girildi");
 }
 }
 }
 });
 }
 return jButton;
}
private JButton getJButton1() {
 if (jButton1 == null) {
jButton1 = new JButton();
jButton1.setBounds(new Rectangle(232, 391, 81, 21));
jButton1.setText("Kapat");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
 setVisible(false);
DuzenlenecekBiletiBul duzGit=new DuzenlenecekBiletiBul();
 duzGit.setVisible(true);
 }
 });
 }
 return jButton1;
 }
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
 public void run() {
BiletiGuncelle thisClass = new BiletiGuncelle();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 thisClass.setVisible(true);
 }
 });
 }
BiletGuncelleUyg bilGunc;
public BiletiGuncelle() {
 super();
 initialize();
 bilGunc=new BiletGuncelleUyg();
}
private void initialize() {
 this.setSize(454, 489);
this.setContentPane(getJContentPane());
this.setTitle("Guncellemeyi Gerceklestir");
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel9 = new JLabel();
jLabel9.setBounds(new Rectangle(281, 16, 134, 16));
jLabel9.setText("Ucus No Degistirilmez");
jLabel8 = new JLabel();
jLabel8.setBounds(new Rectangle(21, 336, 69, 16));
jLabel8.setText("Koltuk No:");
jLabel7 = new JLabel();
jLabel7.setBounds(new Rectangle(19, 301, 73, 16));
jLabel7.setText("Bilet Bedeli:");
jLabel6 = new JLabel();
jLabel6.setBounds(new Rectangle(16, 263, 74, 16));
jLabel6.setText("Firma Ismi:");
jLabel5 = new JLabel();
jLabel5.setBounds(new Rectangle(15, 226, 79, 16));
jLabel5.setText("Varis Saati:");
jLabel4 = new JLabel();
jLabel4.setBounds(new Rectangle(13, 180, 84, 16));
jLabel4.setText("Kalkis Saati:");
jLabel3 = new JLabel();
jLabel3.setBounds(new Rectangle(12, 141, 84, 16));
jLabel3.setText("O Gunku Tarih:");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(15, 103, 69, 16));
jLabel2.setText("Varis Yeri:");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(18, 62, 63, 16));
jLabel1.setText("Kalkis Yeri:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(15, 22, 55, 16));
jLabel.setText("Ucus No:");
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(getJTextField4(), null);
jContentPane.add(jLabel5, null);
jContentPane.add(getJTextField5(), null);
jContentPane.add(jLabel6, null);
jContentPane.add(getJTextField6(), null);
jContentPane.add(jLabel7, null);
jContentPane.add(getJTextField7(), null);
jContentPane.add(jLabel8, null);
jContentPane.add(getJTextField8(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(jLabel9, null);
jContentPane.add(getJButton1(), null);
 }
 return jContentPane;
 }
}



package www.ethemsulan.com;
import javax.swing.SwingUtilities;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JButton;
import java.awt.Rectangle;
public class BiletIslemleri extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JButton jButton3 = null;
private JButton jButton4 = null;
private JButton getJButton() {
  if (jButton == null) {
  jButton = new JButton();
jButton.setBounds(new Rectangle(22, 33, 113, 31));
  jButton.setText("Bilet Ekle");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
BiletEklemeSinifi obj=new BiletEklemeSinifi();
//Buttona tıklanınca biletekleme formunu açar ve kendisi(biletişelemleri) kaybolur
  obj.setVisible(true);
  setVisible(false);
        }
      });
    }
    return jButton;
  }
private JButton getJButton1() {
  if (jButton1 == null) {
  jButton1 = new JButton();
jButton1.setBounds(new Rectangle(184, 33, 146, 27));
jButton1.setText("Aktif Biletleri Gor");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
BiletleriGorSatilmayan bGos=new BiletleriGorSatilmayan();
  bGos.setVisible(true);
  setVisible(false);
      }
    });
  }
    return jButton1;
  }
private JButton getJButton2() {
  if (jButton2 == null) {
  jButton2 = new JButton();
jButton2.setBounds(new Rectangle(21, 121, 121, 34));
jButton2.setText("Bilet Duzenle");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
DuzenlenecekBiletiBul duzBil=new DuzenlenecekBiletiBul();
  duzBil.setVisible(true);
  setVisible(false);
    }
  });
  }
  return jButton2;
}
private JButton getJButton3() {
  if (jButton3 == null) {
  jButton3 = new JButton();
jButton3.setBounds(new Rectangle(125, 198, 163, 28));
jButton3.setText("Sistemden Cikis");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
setVisible(false);
    }
  });
  }
  return jButton3;
}
private JButton getJButton4() {
if (jButton4 == null) {
  jButton4 = new JButton();
jButton4.setBounds(new Rectangle(182, 120, 149, 34));
jButton4.setText("Uye Sil");
jButton4.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e) {
UyeSilmeSayfasi obj=new UyeSilmeSayfasi();
  setVisible(false);
  obj.setVisible(true);
      }
    });
  }
  return jButton4;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
  public void run() {
BiletIslemleri thisClass = new BiletIslemleri();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  thisClass.setVisible(true);
    }
  });
}
public BiletIslemleri() {
  super();
  initialize();
}
private void initialize() {
this.setSize(445, 291);
this.setContentPane(getJContentPane());
this.setTitle("Bilet Islemleri");
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton1(), null);
jContentPane.add(getJButton2(), null);
jContentPane.add(getJButton3(), null);
jContentPane.add(getJButton4(), null);
  }
  return jContentPane;
 }
}
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.JComboBox;
import javax.swing.JButton;
import BiletEklemeSinifiUyg.BiletEklemeSinifiUyg;
import java.lang.String;
public class BiletEklemeSinifi 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 JComboBox jComboBox = null;
private JLabel jLabel2 = null;
private JComboBox jComboBox1 = null;
private JTextField getJTextField() {
  if (jTextField == null) {
  jTextField = new JTextField();
jTextField.setBounds(new Rectangle(132, 21, 128, 20));
  }
  return jTextField;
}
String neredenSecilen=null;
private JComboBox getJComboBox() {
if (jComboBox == null) {
jComboBox = new JComboBox();
jComboBox.setBounds(new Rectangle(133, 60, 127, 25));
//comboboxta seçilen eleman değiştiğinde tetiklenir olay
jComboBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
//jomboboxta seçilen değeri alı
r.getSelectedItem() metodu ile
  neredenSecilen=(String) jComboBox.getSelectedItem();
      }
    });
  }
//Il isimlerini comboboxa atar
jComboBox.addItem("Istanbul");
jComboBox.addItem("Ankara");
jComboBox.addItem("Izmir");
jComboBox.addItem("Eskisehir");
jComboBox.addItem("Canakkale");
jComboBox.addItem("Mersin");
jComboBox.addItem("Erzurum");
jComboBox.addItem("Malatya");
jComboBox.addItem("Hatay");
jComboBox.addItem("Sinop");
jComboBox.addItem("Samson");
jComboBox.addItem("Sivas");
  return jComboBox;
}
String nereyeSecilen=null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JTextField jTextField1 = null;
private JLabel jLabel5 = null;
private JTextField jTextField2 = null;
private JLabel jLabel6 = null;
private JLabel jLabel7 = null;
private JTextField jTextField3 = null;
private JLabel jLabel8 = null;
private JLabel jLabel9 = null;
private JTextField jTextField4 = null;
private JLabel jLabel10 = null;
private JTextField jTextField5 = null;
private JLabel jLabel11 = null;
private JTextField jTextField6 = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JLabel jLabe
l12 = null;
private JLabel jLabel13 = null;
private JComboBox getJComboBox1() {
  if (jComboBox1 == null) {
  jComboBox1 = new JComboBox();
jComboBox1.setBounds(new Rectangle(132, 107, 130, 25));
jComboBox1.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
    nereyeSecilen=(String) jComboBox1.getSelectedItem();
    }
  });
  }
jComboBox1.addItem("Istanbul");
jComboBox1.addItem("Ankara");
jComboBox1.addItem("Izmir");
jComboBox1.addItem("Eskisehir");
jComboBox1.addItem("Canakkale");
jComboBox1.addItem("Mersin");
jComboBox1.addItem("Erzurum");
jComboBox1.addItem("Malatya");
jComboBox1.addItem("Hatay");
jComboBox1.addItem("Sinop");
jComboBox1.addItem("Samson");
jComboBox1.addItem("Sivas");
return jComboBox1;
}
private JTextField getJTextField1() {
if (jTextField1 == null) {
jTextField1 = new JTextField();
jTextField1.setBounds(new Rectangle(132, 158, 125, 20));
  }
return jTextField1;
}
private JTextField getJTextField2() {
if (jTextField2 == null) {
  jTextField2 = new JTextField();
jTextField2.setBounds(new Rectangle(131, 201, 124, 20));
  }
  return jTextField2;
}
private JTextField getJTextField3() {
if (jTextField3 == null) {
  jTextField3 = new JTextField();
jTextField3.setBounds(new Rectangle(132, 239, 122, 20));
  }
  return jTextField3;
}
private JTextField getJTextField4() {
if (jTextField4 == null) {
  jTextField4 = new JTextField();
jTextField4.setBounds(new Rectangle(135, 280, 115, 20));
  }
return jTextField4;
}
private JTextField getJTextField5() {
if (jTextField5 == null) {
  jTextField5 = new JTextField();
jTextField5.setBounds(new Rectangle(133, 317, 119, 20));
  }
return jTextField5;
}
private JTextField getJTextField6() {
if (jTextField6 == null) {
  jTextField6 = new JTextField();
jTextField6.setBounds(new Rectangle(133, 358, 114, 20));
  }
  return jTextField6;
  }
private JButton getJButton(){
  if (jButton == null) {
  jButton = new JButton();
jButton.setBounds(new Rectangle(78, 424, 113, 25));
  jButton.setText("Kaydet");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e){
  String uNo=jTextField.getText().trim();
  String uNereden=neredenSecilen;
  String uNereye=nereyeSecilen;
String uTarih=jTextField1.getText().trim();
String uSaatKalkis=jTextField2.getText().trim();
String uSaatVaris=jTextField3.getText().trim();
String uHavaYolu=jTextField4.getText().trim();
  int uFiyat=0; 
  int uKoltukNo=0;
if("".equals(jTextField5.getText().trim()) | "".equals(
    jTextField6.getText().trim())){
JOptionPane.showMessageDialog(null, "Fiyat ya da koltuk no bos olamaz");
}else{
uFiyat=Integer.parseInt(jTextField5.getText().trim());
uKoltukNo=Integer.parseInt(jTextField6.getText().trim());
    }
boolean biletEklendimi=false;
if("".equals(uNo) | "".equals(uNereye) | "".equals(uNereden) |
"".equals(uTarih) | "".equals(uSaatKalkis) | "".equals(
uSaatVaris) | "".equals(uHavaYolu) | "".equals(jTextField5.
getText().trim()) | "".equals(jTextField6.getText().trim()))
{
JOptionPane.showMessageDialog(null, "Alanlar bos gecilemez");
    }
//düzenli iade tarih saat kontrolunu gerçekleştirir.Daha önce açıklamıştım
else if(uTarih.matches("\\d{4}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])")
& uSaatKalkis.matches("^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$")
&uSaatVaris.matches("^(([0-1]?[0-9])|([2][0-3])):([0-5]?[0-9])(:([0-5]?[0-9]))?$")) 
{
biletEklendimi=obj.yeniBiletEkle(uNo,uNereden,uNereye,uTarih,
    uSaatKalkis,uSaatVaris,uHavaYolu,uFiyat,uKoltukNo);      
    }
if(biletEklendimi){
JOptionPane.showMessageDialog(null, "Bilet basariyla eklendi");
     jTextField.setText(null);
     jTextField1.setText(null);
     jTextField2.setText(null);
    jTextField3.setText(null);
     jTextField4.setText(null);
     jTextField5.setText(null);
     jTextField6.setText(null);
 }else{
JOptionPane.showMessageDialog(null, "Bilet ekleme de hata var");
        }
    }
  });
}
  return jButton;
}
private JButton getJButton1() {
  if (jButton1 == null) {
  jButton1 = new JButton();
jButton1.setBounds(new Rectangle(233, 427, 108, 20));
  jButton1.setText("Kapat");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
int uyari=JOptionPane.showConfirmDialog(null, "Cikmak Istediginizden" +
    " Eminmisiniz", "Formu Kapat", 0);
  if(uyari==0){
  setVisible(false);
  BiletIslemleri obj=new BiletIslemleri();
  obj.setVisible(true);
        }
      }
    });
  }
  return jButton1;
  }
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
  public void run() {
BiletEklemeSinifi thisClass = new BiletEklemeSinifi();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  thisClass.setVisible(true);
    }
  });
 }
BiletEklemeSinifiUyg obj;
  public BiletEklemeSinifi() {
    super();
    initialize();
  obj=new BiletEklemeSinifiUyg();  
  }
private void initialize() {
this.setSize(435, 514);
this.setContentPane(getJContentPane());
this.setTitle("Bilet Satmak Icin Ekle");
}
private JPanel getJContentPane() {
if (jContentPane == null) {
jLabel13 = new JLabel();
jLabel13.setBounds(new Rectangle(290, 366, 95, 16));
jLabel13.setText("Sayi Girilecek");
jLabel12 = new JLabel();
jLabel12.setBounds(new Rectangle(290, 313, 90, 16));
jLabel12.setText("Sayi Girilecek");
jLabel11 = new JLabel();
jLabel11.setBounds(new Rectangle(16, 364, 67, 16));
jLabel11.setText("Kolyuk No:");
jLabel10 = new JLabel();
jLabel10.setBounds(new Rectangle(16, 323, 66, 16));
jLabel10.setText("Ucret:");
jLabel9 = new JLabel();
jLabel9.setBounds(new Rectangle(9, 282, 70, 16));
jLabel9.setText("Hava Yolu:");
jLabel8 = new JLabel();
jLabel8.setBounds(new Rectangle(295, 242, 88, 16));
jLabel8.setText("16:01:02");
jLabel7 = new JLabel();
jLabel7.setBounds(new Rectangle(13, 247, 72, 16));
jLabel7.setText("Varis Saati:");
jLabel6 = new JLabel();
jLabel6.setBounds(new Rectangle(295, 203, 87, 16));
jLabel6.setText("15:42:12");
jLabel5 = new JLabel();
jLabel5.setBounds(new Rectangle(9, 206, 76, 16));
jLabel5.setText("Kalkis Saati:");
jLabel4 = new JLabel();
jLabel4.setBounds(new Rectangle(294, 162, 86, 16));
jLabel4.setText("2010-01-02");
jLabel3 = new JLabel();
jLabel3.setBounds(new Rectangle(14, 162, 71, 16));
jLabel3.setText("Bilet Tarih:");
jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(15, 110, 78, 16));
jLabel2.setText("Nereye:");
jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(15, 66, 77, 16));
jLabel1.setText("Nereden:");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(10, 23, 81, 16));
jLabel.setText("Ucus No:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(getJTextField(), null);
jContentPane.add(jLabel1, null);
jContentPane.add(getJComboBox(), null);
jContentPane.add(jLabel2, null);
jContentPane.add(getJComboBox1(), null);
jContentPane.add(jLabel3, null);
jContentPane.add(jLabel4, null);
jContentPane.add(getJTextField1(), null);
jContentPane.add(jLabel5, null);
jContentPane.add(getJTextField2(), null);
jContentPane.add(jLabel6, null);
jContentPane.add(jLabel7, null);
jContentPane.add(getJTextField3(), null);
jContentPane.add(jLabel8, null);
jContentPane.add(jLabel9, null);
jContentPane.add(getJTextField4(), null);
jContentPane.add(jLabel10, null);
jContentPane.add(getJTextField5(), null);
jContentPane.add(jLabel11, null);
jContentPane.add(getJTextField6(), null);
jContentPane.add(getJButton(), null);
jContentPane.add(getJButton1(), null);
jContentPane.add(jLabel12, null);
jContentPane.add(jLabel13, null);
}
return jContentPane;
}
}
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;
//Kendi oluşturduğum paketi kullanabilmek için import ediyorum.
import AnaSayfaUyg.AnaSayfaUyg;
public class AnaSayfa 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 JPasswordField jPasswordField = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JLabel jLabel2 = null;

private JTextField getJTextField() {
if (jTextField == null) {
  jTextField = new JTextField();
jTextField.setBounds(new Rectangle(119, 16, 121, 20));
  }
  return jTextField;
}
private JPasswordField getJPasswordField() {
if (jPasswordField == null) {
  jPasswordField = new JPasswordField();
jPasswordField.setBounds(new Rectangle(119, 66, 124, 20));
  }
  return jPasswordField;
  }
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(42, 139, 123, 27));
jButton.setText("Sisteme Giris");
//button tıklanınca gerçekleşmesini istediğimiz şeyi actionPerformed içine yazıyoruz
//jButton.addActionListener buttonu dinlemeye adık
jButton.addActionListener(new java.awt.event.ActionListener() {   
public void actionPerformed(java.awt.event.ActionEvent e) {  
String kulGirilen=jTextField.getText().trim();
String kulParolaGirilen=jPasswordField.getText().trim();
  int kontrol=0;
if("".equals(kulGirilen) | "".equals(kulParolaGirilen)){
JOptionPane.showMessageDialog(null, "Alanalr bos olamaz");
  }else{
kontrol=aSayUygObj.sistemeGiris(kulGirilen, kulParolaGirilen);
  if(kontrol==1){
//Kul adi ve parola doğru girilirse BiletIslemleri formu görüntülenecek
BiletIslemleri biletCag=new BiletIslemleri();
  biletCag.setVisible(true);
  setVisible(false);
    }
  else{
JOptionPane.showMessageDialog(null, "yanli kullanici adi ya da parola");
        }
    }    
  }
//jButton.addActionListener( diğer parantezi burada ; ile sonlanır
//bu kullanım javada yaygındır
  });
  }
  return jButton;
  }
private JButton getJButton1() {
  if (jButton1 == null) {
  jButton1 = new JButton();
jButton1.setBounds(new Rectangle(198, 139, 120, 29));
  jButton1.setText("Uye Ol");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//üye kayıt formu görüntülenecek buttona tıklanınca
UyeKayitGerceklestirme uyOl=new UyeKayitGerceklestirme();
  uyOl.setVisible(true);
  setVisible(false);
    }
  });
  }
  return jButton1;
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
AnaSayfa thisClass = new AnaSayfa();
thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
thisClass.setVisible(true);
    }
  });
}
AnaSayfaUyg aSayUygObj=null;
public AnaSayfa() {
  super();
  initialize();
  aSayUygObj=new AnaSayfaUyg();
  }

private void initialize() {
  this.setSize(438, 267);
this.setContentPane(getJContentPane());
this.setTitle("Sisteme Giris Yap");
}
private JPanel getJContentPane() {
  if (jContentPane == null) {
  jLabel2 = new JLabel();
jLabel2.setBounds(new Rectangle(263, 18, 146, 16));
jLabel2.setText("ethemsulan@gmail.com");
  jLabel1 = new JLabel();
jLabel1.setBounds(new Rectangle(16, 67, 79, 16));
  jLabel1.setText("Password:");
  jLabel = new JLabel();
jLabel.setBounds(new Rectangle(16, 17, 78, 16));
  jLabel.setText("Kul Email:");
  jContentPane = new JPanel();
  jContentPane.setLayout(null);
  jContentPane.add(jLabel, null);
jContentPane.add(getJTextField(), null);
  jContentPane.add(jLabel1, null);
jContentPane.add(getJPasswordField(), null);
  jContentPane.add(getJButton(), null);
  jContentPane.add(getJButton1(), null);
  jContentPane.add(jLabel2, null);
    }
  return jContentPane;
  }
}  
package UyeSilmeUyg;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import BiletEklemeSinifiUyg.
UygulaBaglantiButunSiniflardaortakKullaniliyor;
public class UyeSilmeUyg extends 
UygulaBaglantiButunSiniflardaortakKullaniliyor {
private PreparedStatement uyg = null;
private ResultSet sonuc=null;
public UyeSilmeUyg(){
  try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
  }try {
baglanti=DriverManager.getConnection("jdbc:mysql://" +
    "localhost/cevikyazilim", "root", "123");
} catch (SQLException e1) {
  e1.printStackTrace();
    }
  }
public int uyeVarmi(String tcSorgula){
  int kont=0;
  try {
setUyg(baglanti.prepareStatement("select tcno " +
    "from uyebilgileri where tcno=?"));
getUyg().setString(1, tcSorgula);
} catch (SQLException e) {
  e.printStackTrace();
  }try {
setSonuc(getUyg().executeQuery());
} catch (SQLException e) {
e.printStackTrace();
}try {
  while (getSonuc().next()) {
tcSorgula=getSonuc().getString(1).trim();
  kont=1;
  }
  } catch (SQLException e) {
  e.printStackTrace();
  }
if(kont==1){
  try {
setUyg(baglanti.prepareStatement("delete from " +
    "uyebilgileri where tcno=? "));
  } catch (SQLException e) {
  e.printStackTrace();
  }try {
getUyg().setString(1, tcSorgula);
} catch (SQLException e) {
  e.printStackTrace();
  }try {
getUyg().executeUpdate();
} catch (SQLException e) {
  e.printStackTrace();
  }
  }
return kont;  
  }
//Encapsulite field tefoctoringi uygulanmis.
//Bu object orientin en temel 
//ozelligidir.Verileri disaridan erisimini kisitla.
//Mumkun oldukcadegisken ya da metodlar public olmasin.
//Eger public ise farkinda olmadan baska yerden
//erisip bu degeri degistirebilirler.Dolayisiyla yanli sonuc aliriz.
void setUyg(PreparedStatement uyg) {
  this.uyg = uyg;
}
PreparedStatement getUyg() {
  return uyg;
}
void setSonuc(ResultSet sonuc) {
  this.sonuc = sonuc;
}
ResultSet getSonuc() {
  return sonuc;
  }
}
package UyeKayitGerceklestirmeUyg;
import java.sql.Connection;
import java.sql.Statement;
import BiletEklemeSinifiUyg.UygulaBaglantiButunSiniflardaortakKullaniliyor;
public class UyeKayitGerceklestirmeUygData extends
  UygulaBaglantiButunSiniflardaortakKullaniliyor {
private Statement uyg;
public UyeKayitGerceklestirmeUygData(Connection baglanti,
    Statement uyg)
{
  this.baglanti = baglanti;
  this.uyg = uyg;
  }
public Connection getBaglanti() {
    return baglanti;
  }
public void setBaglanti(Connection baglanti) {
  this.baglanti = baglanti;
  }
public Statement getUyg() {
    return uyg;
  }
public void setUyg(Statement uyg) {
    this.uyg = uyg;
  }
}
package UyeKayitGerceklestirmeUyg;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import BiletEklemeSinifiUyg.UygulaBaglantiButunSiniflardaortakKullaniliyor;
public class UyeKayitGerceklestirmeUyg extends
UygulaBaglantiButunSiniflardaortakKullaniliyor {
UyeKayitGerceklestirmeUygData data = 
new UyeKayitGerceklestirmeUygData(null, null);
public UyeKayitGerceklestirmeUyg(){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e1) {
e1.printStackTrace();
  }try {
data.setBaglanti(DriverManager.getConnection(
"jdbc:mysql://localhost/cevikyazilim", "root", "123"));
} catch (SQLException e1) {
  e1.printStackTrace();
    }
  }
//Extrac Superclass bir sinifta birden fazla isi 
//gerceklestirmek yerine bazi isleri yeni bir sinif olusturulup
//orada gerceklstirmektir.Bu siniflarin sade ve anlasilir olmasini saglar.
//UyeKayitGerceklestirmeUygData conenction ve statement
//tanimlanmis ve gelen degeri onlara atama yapan
//statement ve connection tipinde set ve get metodlari var.Yani is bolumu yaparak
//Sinif sayisi artmasi sorun degil ama bir sinifta cok falz kod yazmak
//o sinifi anlasilmaz kilar.
public String uyeKayitGerceklestir(String tcG,String
  adG,String soyadG,String emailG,String parolaG){
String basarilimi="Kayit basarisiz";
int emailParcalama=0;
String[] dizi=emailG.split("@|\\.");
for (String string : dizi) {
  emailParcalama++;
  }
if("".equals(tcG) | "".equals(adG) | "".equals(soyadG) |
    "".equals(emailG) | "".equals(parolaG))
{
JOptionPane.showMessageDialog(null, "Alanlar bos gecilemez");
}else if(emailParcalama<3){
JOptionPane.showMessageDialog(null, "email@email.com seklinde" +
" girmediniz.Bu yanlis email formati girilen test metod icin uyari veriyor");
}else if(tcG.length()!=11){
JOptionPane.showMessageDialog(null, "TC Kimlik no 11 rakamdan olsur");
}else{
try {
data.setUyg(data.getBaglanti().createStatement()); 
String sqlKodu="insert into uyebilgileri(tcno,adi,soyadi," +
    "email,parola) values('"+tcG+"','"+adG+"','"+soyadG+
    "','"+emailG+"','"+parolaG+"')";
data.getUyg().executeUpdate(sqlKodu);
basarilimi="Basarili";
} catch (SQLException e2) {
e2.printStackTrace();
    }
    }
return basarilimi.trim();
  }
}
package BiletSatmaSayfasiUyg;
import java.sql.DriverManager;
import java.sql.SQLException;
import javax.swing.JOptionPane;
import BiletEklemeSinifiUyg.UygulaBaglantiButunSiniflardaortakKullaniliyor;
public class BiletSatmaSayfasiUyg extends
UygulaBaglantiButunSiniflardaortakKullaniliyor {
public BiletSatmaSayfasiUyg(){
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
  e.printStackTrace();
}try {
baglanti = DriverManager.getConnection("jdbc:mysql://" +
    "localhost/cevikyazilim", "root","123");
} catch (SQLException e) {
    e.printStackTrace();
}try {
uygula=baglanti.createStatement();
  } catch (SQLException e1) {
    e1.printStackTrace();
    }
  }
public String biletSil(String ucusNo){
String sqlSordu="delete from bilet where ucusno='"+ucusNo+"'";
int uyari=JOptionPane.showConfirmDialog(null,
  ucusNo+" Nolu biletin satisi tamamlansain mi?",
  "Bilet Satisi gerceklessin mi", 0);
if(uyari==0 &ucusNo!=null){      
try {
  uygula.executeUpdate(sqlSordu);
} catch (SQLException e1) {
  e1.printStackTrace();
    }
    }
return ucusNo.trim();
  }
}