arkadaşlar merhaba aşağıdaki forma girilen bilgileri veritabanına kaydetmesini istiyorum nasıl yapabilirim kodlamayı :/
package kayit;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.Border;
public class Main implements ActionListener {
JFrame pencere = new JFrame("Veri Formu");
JTextField adAlani = new JTextField();
JTextField soyadAlani = new JTextField();
JTextField babaAdiAlani = new JTextField();
JTextField tcAlani = new JTextField();
JTextField dogumTarihiAlani = new JTextField();
JTextField dogumYeriAlani = new JTextField();
JButton kaydetButton = new JButton("Kaydet");
JPanel liste = new JPanel();
int kayitSayisi = 0;
public void calistir() {
pencere.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pencere.setSize(800, 600);
JPanel panel = new JPanel();
panel.setLayout(null);
panel.setOpaque(true);
//Etiket
JLabel label = new JLabel("Ad :");
panel.add(label);
label.setBounds(20, 20, 100, 20);
panel.add(adAlani);
adAlani.setBounds(130, 20, 200, 20);
//kodlar buraya yazılacak
label = new JLabel("Soyad :");
panel.add(label);
label.setBounds(380, 20, 100, 20);
panel.add(soyadAlani);
soyadAlani.setBounds(490, 20, 200, 20);
label= new JLabel("Baba adi :");
panel.add(label);
label.setBounds(20, 50, 100, 20);
panel.add(babaAdiAlani);
babaAdiAlani.setBounds(130, 50, 200, 20);
label = new JLabel ("TC No :") ;
panel.add(label);
label.setBounds(380, 50, 100, 20) ;
panel.add(tcAlani);
tcAlani.setBounds(490, 50, 200, 20);
label = new JLabel ("Doğum Tarihi :") ;
panel.add(label);
label.setBounds(20, 80, 100, 20) ;
panel.add(dogumTarihiAlani);
dogumTarihiAlani.setBounds(130,80,200,20);
label = new JLabel ("Doğum Yeri :") ;
panel.add(label);
label.setBounds(380, 80, 100, 20) ;
panel.add(dogumYeriAlani);
dogumYeriAlani.setBounds(490,80,200,20);
panel.add(kaydetButton);
kaydetButton.setBounds(330, 120, 100, 20);
kaydetButton.addActionListener(this);
//kodlar bitiş
liste.setLayout(null);
panel.add(liste);
liste.setBounds(20, 160, 760, 360);
Font font = new Font("Arial", Font.BOLD, 14);
label = new JLabel("Ad");
label.setFont(font);
liste.add(label);
label.setBounds(0, 0, 120, 20);
label = new JLabel("Soyad");
label.setFont(font);
liste.add(label);
label.setBounds(120, 0, 120, 20);
label = new JLabel("Baba Adı");
label.setFont(font);
liste.add(label);
label.setBounds(240, 0, 120, 20);
label = new JLabel("TC No");
label.setFont(font);
liste.add(label);
label.setBounds(360, 0, 120, 20);
label = new JLabel("Doğum Tarihi");
label.setFont(font);
liste.add(label);
label.setBounds(480, 0, 120, 20);
label = new JLabel("Doğum Yeri");
label.setFont(font);
liste.add(label);
label.setBounds(600, 0, 120, 20);
pencere.setContentPane(panel);
pencere.setVisible(true);
adAlani.requestFocus();
}
@Override
public void actionPerformed(ActionEvent e) {
kayitSayisi++;
JLabel label = new JLabel( adAlani.getText() );
liste.add(label);
label.setBounds(0, kayitSayisi*20, 120, 20);
label = new JLabel( soyadAlani.getText() );
liste.add(label);
label.setBounds(120, kayitSayisi*20, 120, 20);
label = new JLabel(babaAdiAlani.getText() );
liste.add(label);
label.setBounds(240, kayitSayisi*20, 120, 20);
label = new JLabel(tcAlani.getText());
liste.add(label);
label.setBounds(360, kayitSayisi*20, 120, 20);
label = new JLabel(dogumTarihiAlani.getText());
liste.add(label);
label.setBounds(480, kayitSayisi*20, 120, 20);
label = new JLabel(dogumYeriAlani.getText());
liste.add(label);
label.setBounds(600, kayitSayisi*20, 120, 20);
adAlani.setText("");
soyadAlani.setText("");
babaAdiAlani.setText("");
tcAlani.setText("");
dogumTarihiAlani.setText("");
dogumYeriAlani.setText("");
adAlani.requestFocus();
}
public static void main(String[] args) {
Main program = new Main();
program.calistir();
}
}