Ders programı uygulaması indir

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
public class Calistir extends JFrame implements ActionListener,ListSelectionListener,ItemListener {
	 DefaultListModel<String>[] dlm;
     JList<String>[] jlist;
     String[] lbl= {"Ders","Hoca","Gün","Saat","Teorik","Uygulama"};
     JComboBox<String> jcb;
     JComboBox<Integer> jcb_id;
     JComboBox<Integer> jcb_orgun;
	public Calistir()  {
		this.setTitle("Ders Programı");
		this.setSize(700,450);
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setLayout(new FlowLayout());
		
		String[] btn_txt={"Ders","Hoca","Eşleştirme"};
		JPanel jpn_main=new JPanel();
		jpn_main.setPreferredSize(new Dimension(700, 450));
		
		dlm=new DefaultListModel[lbl.length];
		jlist=new JList[dlm.length];
		
		
		for(int i=0;i<dlm.length;i++) {
			JPanel jpn=new JPanel();
			jpn.setPreferredSize(new Dimension(100, 400));
			
			JLabel jlb=new JLabel(lbl[i]);
			jlb.setPreferredSize(new Dimension(100,25));
			
			dlm[i]=new DefaultListModel<String>();
			jlist[i]=new JList<String>(dlm[i]);
			jlist[i].addListSelectionListener(this);
			JScrollPane jscp=new JScrollPane(jlist[i]);
		    jscp.setPreferredSize(new Dimension(100, 300));
		    
		    jpn.add(jlb);
		    jpn.add(jscp);
		  
		    jpn_main.add(jpn);
		    if(i!=0&&(i-1)<btn_txt.length){
		    	JButton btn=new JButton(btn_txt[i-1]);
		    	btn.setPreferredSize(new Dimension(100,25));
		    	btn.addActionListener(this);
		    	btn.setActionCommand(btn_txt[i-1]);	
		    	jpn.add(btn);
		    }
		    if(i==0) {
		       jcb=new JComboBox<String>();
		       jcb.setSelectedIndex(-1);
		       jcb.setPreferredSize(new Dimension(100, 25));
		       jcb.addItemListener(this);
		       jcb_id=new JComboBox<Integer>(); 
		       jcb_orgun=new JComboBox<Integer>();
		       jpn.add(jcb);   
		    }
		}
		combodoldur();
		if(jcb_id.getItemCount()==0)
		listdoldur(0,0);
		else
		listdoldur(jcb_id.getItemAt(0),jcb_orgun.getItemAt(0));
		this.add(jpn_main);
	   this.setVisible(true);
	}
	@Override
	public void actionPerformed(ActionEvent arg0) {
	
		switch(arg0.getActionCommand()) {
		
		case "Ders":new Ders(this);break;
		case "Hoca":new Hoca(this);break;
		case "Eşleştirme":new Eslestirme(this);break;
		}
	}
 public static void main(String[] arg) {
	 
	 new Calistir();
 }
@Override
public void valueChanged(ListSelectionEvent arg0) {
	JList secilen=(JList)arg0.getSource();
	for(int i=0;i<jlist.length;i++)
		jlist[i].setSelectedIndex(secilen.getSelectedIndex());
}
Connection baglanti;
public void baglan() {
	try {
			baglanti=DriverManager.getConnection("jdbc:sqlite:Ders Programi.db");
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
	
}
public void combodoldur() {
	try {
		baglan();
		PreparedStatement sorgu=baglanti.prepareStatement("select distinct sinif,orgun from dersler");
		ResultSet veri=sorgu.executeQuery();
		jcb.removeAllItems();
	    jcb_id.removeAllItems();
	    jcb_orgun.removeAllItems();
		while(veri.next()) {
			int sinif=veri.getInt("sinif");
			int orgun=veri.getInt("orgun");
			jcb.addItem(sinif+".Sınıf"+"("+orgun+".Örgün"+")");
			jcb_id.addItem(sinif);
			jcb_orgun.addItem(orgun);
			
		}
	} catch (Exception e) {
		JOptionPane.showMessageDialog(this, e.getMessage()+"dsaasds");
	}
	
}
public void listdoldur(int sinif,int orgun) {
	try {
			baglan();
			 String sql="select d.teoriksaati as 'teorik', d.uygsaati as 'uyg', d.sinif as 'sinif',d.orgun as 'orgun',h.hocaismi as 'hoca',d.dersismi as 'ders',s.saad as 'saat',g.isim as 'gun' ,e.tip as 'tip' from eslestirme e inner join hoca h on h.id=e.hocaid inner join gun g on g.id=e.gunid inner join Saat s on s.id=e.saatid	inner join dersler d on d.id=e.dersid 	and e.dersid=d.id  where sinif=? and orgun=?" ;
			 		
			PreparedStatement sorgu=baglanti.prepareStatement(sql);
			sorgu.setInt(1,sinif);
			sorgu.setInt(2, orgun);
			ResultSet veri=sorgu.executeQuery();
		   for(int i=0;i<dlm.length;i++)
			   dlm[i].clear();
			while(veri.next()) {
				dlm[0].addElement(veri.getString("ders"));
				dlm[1].addElement(veri.getString("hoca"));
				dlm[2].addElement(veri.getString("gun"));
				dlm[3].addElement(veri.getString("saat"));
				dlm[4].addElement(veri.getString("teorik"));
				dlm[5].addElement(veri.getString("uyg"));
				
			}
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
}
@Override
public void itemStateChanged(ItemEvent arg0) {
	
          if(arg0.getStateChange()==2) {
	int secilen=jcb.getSelectedIndex();	
	if(secilen>-1) {
	listdoldur(jcb_id.getItemAt(secilen),jcb_orgun.getItemAt(secilen));

}
}
}
}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
public class Ders extends JFrame implements ActionListener,ListSelectionListener,WindowListener{
      DefaultListModel<String>[] dlm;
      JList<String>[] jlist;
      String[] lbl= {"Ders Ad","Kodu","Teorik Saati","Uyg Saati","Sınıf","Örgün"};
	  JTextField[] jtext;
	  Calistir frm;
      public Ders(Calistir frm) {
    	 this.frm=frm;
    	 frm.setVisible(false);
		this.setTitle("Ders");
		this.setSize(700,450);
		this.addWindowListener(this);
		this.setLayout(new FlowLayout());
		
		JPanel jpn_main=new JPanel();
		jpn_main.setPreferredSize(new Dimension(700, 450));
	   
		dlm=new DefaultListModel[lbl.length];
		jlist=new JList[dlm.length];
		jtext=new JTextField[jlist.length];
		
		for(int i=0;i<dlm.length;i++) {
			JPanel jpn=new JPanel();
			jpn.setPreferredSize(new Dimension(100, 450));
			
			JLabel jlb=new JLabel(lbl[i]);
			jlb.setPreferredSize(new Dimension(100,25));
			
			dlm[i]=new DefaultListModel<String>();
			jlist[i]=new JList<String>(dlm[i]);
			jlist[i].addListSelectionListener(this);
			JScrollPane jscp=new JScrollPane(jlist[i]);
		    jscp.setPreferredSize(new Dimension(100, 300));
		    
		    jtext[i]=new JTextField();
		    jtext[i].setPreferredSize(new Dimension(100, 25));
		    
		    jpn.add(jlb);
		    jpn.add(jscp);
		    jpn.add(jtext[i]);
		    if(i==0) {
		    JButton btn=new JButton("Ekle");
		    btn.setPreferredSize(new Dimension(100, 25));
		    btn.addActionListener(this);
		    jpn.add(btn);	
		    }
		    jpn_main.add(jpn);
		}
		listdoldur();
		this.add(jpn_main);
		this.setVisible(true);
	}
   public boolean kontrol() {
	   int sayac=0;
	   for(int i=0;i<jtext.length;i++)
		    if(jtext[i].getText().length()>0)
		    	sayac++;
	   if(sayac==jtext.length)
		   return true;
	   else
		   return false;
   }
   Connection baglanti;
   public void baglan() {
   	try {
			baglanti=DriverManager.getConnection("jdbc:sqlite:Ders Programi.db");
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
   	
   }
   public void listdoldur() {
   	try {
			baglan();
			PreparedStatement sorgu=baglanti.prepareStatement("select * from dersler");
			ResultSet veri=sorgu.executeQuery();
		   for(int i=0;i<dlm.length;i++)
			   dlm[i].clear();
			while(veri.next()) {
				dlm[0].addElement(veri.getString("dersismi"));
				dlm[1].addElement(veri.getString("kodu"));
				dlm[2].addElement(""+veri.getInt("teoriksaati"));
				dlm[3].addElement(""+veri.getInt("uygsaati"));
				dlm[4].addElement(""+veri.getInt("sinif"));
				dlm[5].addElement(""+veri.getInt("orgun"));
			}
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
   }
   public boolean kontrol_ders() {
	   
	   for(int i=0;i<dlm[0].getSize();i++) {
		   if(dlm[0].getElementAt(i).equals(jtext[0].getText())&&dlm[4].getElementAt(i).equals(jtext[4].getText())&&dlm[5].getElementAt(i).equals(jtext[5].getText()))
	           return false;
	   }
   return true;}
	@Override
	public void actionPerformed(ActionEvent e) {
		if(kontrol()&&kontrol_ders()) {
		   
			try {
				 int teoriks=Integer.parseInt(jtext[2].getText());
				 int uygs=Integer.parseInt(jtext[3].getText());
				 int sinif=Integer.parseInt(jtext[4].getText());
				 int orgun=Integer.parseInt(jtext[5].getText());
			baglan();
			PreparedStatement sorgu=baglanti.prepareStatement("insert into dersler(dersismi,kodu,teoriksaati,uygsaati,sinif,orgun) values(?,?,?,?,?,?)");
		    sorgu.setString(1, jtext[0].getText());
		    sorgu.setString(2, jtext[1].getText());
		    sorgu.setInt(3, teoriks);
		    sorgu.setInt(4, uygs);
		    sorgu.setInt(5, sinif);
		    sorgu.setInt(6, orgun);
		    sorgu.executeUpdate();
		    for(int i=0;i<jtext.length;i++)
		    	jtext[i].setText("");
		    listdoldur();
		    frm.combodoldur();
			} catch (Exception e2) {
			JOptionPane.showMessageDialog(this, e2.getMessage());
		}
		}
	}
	@Override
	public void valueChanged(ListSelectionEvent arg0) {
		JList secilen=(JList)arg0.getSource();
		for(int i=0;i<jlist.length;i++)
			jlist[i].setSelectedIndex(secilen.getSelectedIndex());
		
	}
	@Override
	public void windowActivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowClosed(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowClosing(WindowEvent arg0) {
		frm.setVisible(true);
		
	}
	@Override
	public void windowDeactivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowDeiconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowIconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowOpened(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.sql.*;
public class Eslestirme extends JFrame implements ActionListener,ListSelectionListener,WindowListener {
	 DefaultListModel<String>[] dlm;
	 DefaultListModel<Integer>[] dlm_id;
	 DefaultListModel<Integer> dlm_teouyg;
	 DefaultListModel<Integer> dlm_sinifid;
     JList<String>[] jlist;
     String[] lbl= {"Ders","Hoca","Saat","Gün","Tip"};
     JComboBox<String>[] jcb;
     JComboBox<Integer>[] jcb_id;
     Calistir frm;
	public Eslestirme(Calistir frm) {
		 this.frm=frm;
    	 frm.setVisible(false);
		this.setTitle("Eslestirme");
		this.setSize(600,450);
		this.addWindowListener(this);
		this.setLayout(new FlowLayout());
		
		JPanel jpn_main=new JPanel();
		jpn_main.setPreferredSize(new Dimension(600, 450));
	   
		dlm_teouyg=new DefaultListModel<Integer>();
		dlm_sinifid=new DefaultListModel<Integer>();
		dlm=new DefaultListModel[lbl.length];
		dlm_id=new DefaultListModel[lbl.length];
		jlist=new JList[dlm.length];
		jcb=new JComboBox[jlist.length];
		jcb_id=new JComboBox[jlist.length];
		
		for(int i=0;i<dlm.length;i++) {
			JPanel jpn=new JPanel();
			jpn.setPreferredSize(new Dimension(100, 450));
			
			JLabel jlb=new JLabel(lbl[i]);
			jlb.setPreferredSize(new Dimension(100,25));
			
			dlm[i]=new DefaultListModel<String>();
			dlm_id[i]=new DefaultListModel<Integer>();
			jlist[i]=new JList<String>(dlm[i]);
			jlist[i].addListSelectionListener(this);
			JScrollPane jscp=new JScrollPane(jlist[i]);
		    jscp.setPreferredSize(new Dimension(100, 300));
		    
		    jcb[i]=new JComboBox<String>();
		    jcb[i].setPreferredSize(new Dimension(100, 25));
		    jcb_id[i]=new JComboBox<Integer>();
		    
		    jpn.add(jlb);
		    jpn.add(jscp);
		    jpn.add(jcb[i]); 
		    if(i==0) {
		    JButton btn=new JButton("Ekle");
		    btn.setPreferredSize(new Dimension(100, 25));
		    btn.addActionListener(this);
		    jpn.add(btn);	
		    }
		    jpn_main.add(jpn);
		}
		combodoldur();
		listdoldur();
		this.add(jpn_main);
	   this.setVisible(true);
	}
	Connection baglanti;
    public void baglan() {
    	try {
			baglanti=DriverManager.getConnection("jdbc:sqlite:Ders Programi.db");
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
    	
    }
    public void combodoldur() {
    	try {
    		PreparedStatement sorgu=null;
    		ResultSet veri=null;
			baglan();
			sorgu=baglanti.prepareStatement("select id,dersismi,sinif,orgun,teoriksaati,uygsaati from dersler");
		    veri=sorgu.executeQuery();
			jcb[0].removeAllItems();
			jcb_id[0].removeAllItems();
			dlm_teouyg.clear();
			dlm_sinifid.clear();
			while(veri.next()) {
				int sinif_id=veri.getInt("sinif");
				 jcb[0].addItem(veri.getString("dersismi")+"("+sinif_id+"."+veri.getInt("orgun")+"."+"Ögün"+")");
				 jcb_id[0].addItem(veri.getInt("id"));
				 dlm_teouyg.addElement(veri.getInt("teoriksaati")+veri.getInt("uygsaati"));
				 dlm_sinifid.addElement(sinif_id);
			}
			sorgu=baglanti.prepareStatement("select id,hocaismi from hoca");
		    veri=sorgu.executeQuery();
			jcb[1].removeAllItems();
			jcb_id[1].removeAllItems();
			while(veri.next()) {
				 jcb[1].addItem(veri.getString("hocaismi"));
				 jcb_id[1].addItem(veri.getInt("id"));
			}
			sorgu=baglanti.prepareStatement("select id,saad from Saat");
		    veri=sorgu.executeQuery();
			jcb[2].removeAllItems();
			jcb_id[2].removeAllItems();
			while(veri.next()) {
				 jcb[2].addItem(veri.getString("saad"));
				 jcb_id[2].addItem(veri.getInt("id"));	
			}
			sorgu=baglanti.prepareStatement("select id,isim from gun");
		    veri=sorgu.executeQuery();
			jcb[3].removeAllItems();
			jcb_id[3].removeAllItems();
			while(veri.next()) {
				 jcb[3].addItem(veri.getString("isim"));
				 jcb_id[3].addItem(veri.getInt("id"));
			}
			jcb[4].addItem("Teorik");
			jcb[4].addItem("Uygulama");
			jcb_id[4].addItem(1);
			jcb_id[4].addItem(2);
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
    }
    public void listdoldur() {
       	try {
    			baglan();
    			PreparedStatement sorgu=baglanti.prepareStatement("select d.sinif as 'sinif',d.orgun as 'orgun',h.id as 'h',s.id as 's',g.id as 'g',d.dersismi as 'ders',h.hocaismi as 'hoca',g.isim as 'gun',s.saad as 'saat' ,e.tip as 'tip' from eslestirme e inner join dersler d on d.id=e.dersid inner join hoca h on h.id=e.hocaid inner join gun g on g.id=e.gunid inner join Saat s on s.id=e.saatid");
    				
    			ResultSet veri=sorgu.executeQuery();
    		   for(int i=0;i<dlm.length;i++)
    			   dlm[i].clear();
    			while(veri.next()) {
    				int sinif_id=veri.getInt("sinif");
    				dlm[0].addElement(veri.getString("ders")+"("+veri.getInt("sinif")+"."+veri.getInt("orgun")+"."+"Ögün"+")");
    				dlm[1].addElement(veri.getString("hoca"));
    				dlm[2].addElement(veri.getString("saat"));
    				dlm[3].addElement(veri.getString("gun"));
    				String tip="Teorik";
    				if(veri.getInt("tip")==2)
    					tip="Uygulama";
    			    dlm[4].addElement(tip);
    			
    			    dlm_id[0].addElement(sinif_id);
    				dlm_id[1].addElement(veri.getInt("h"));
    				dlm_id[2].addElement(veri.getInt("s"));
    				dlm_id[3].addElement(veri.getInt("g"));
    				
    			}
    		} catch (Exception e) {
    			JOptionPane.showMessageDialog(this, e.getMessage());
    		}
       }
    public boolean teouyg_kontrol(String ders,int teouyg_saat) {
    	int sayac=0;
    	for(int i=0;i<dlm[0].getSize();i++) {
    		
    		if(dlm[0].getElementAt(i).equals(ders))
    			sayac++;
    	}
    		if(sayac==teouyg_saat)//teouyg_saat adlı dlm de teo+uyg toplamı var
    			return false;
    return true;}
    public boolean kontrol(int sinif_id,int h_id,int s_id,int g_id) {
    	
    	for(int i=0;i<dlm_id[0].size();i++) {
    		
    		//Hoca aynı saatte ve aynı gunde derse giremez
    		if(h_id==dlm_id[1].getElementAt(i)&&s_id==dlm_id[2].getElementAt(i)&&g_id==dlm_id[3].getElementAt(i))
				return false;
    		//Aynı saatte aynı sınıfa baska bir ders olamaz
			if(dlm_id[0].getElementAt(i)==sinif_id&&s_id==dlm_id[2].getElementAt(i)&&g_id==dlm_id[3].getElementAt(i))
				return false;
    			
    	}
   return true;
    }
	@Override
	public void actionPerformed(ActionEvent e) {
		int secilen_d=jcb[0].getSelectedIndex();
		int secilen_h=jcb[1].getSelectedIndex();
		int secilen_s=jcb[2].getSelectedIndex();
		int secilen_g=jcb[3].getSelectedIndex();
		if(secilen_d>-1&&secilen_h>-1&&secilen_s>-1&&secilen_g>-1) {
		 int d_id=jcb_id[0].getItemAt(secilen_d);
		 int h_id=jcb_id[1].getItemAt(secilen_h);
		 int s_id=jcb_id[2].getItemAt(secilen_s);
		 int g_id=jcb_id[3].getItemAt(secilen_g);
		 int sinif_id=dlm_sinifid.getElementAt(secilen_d);
		 if(kontrol(sinif_id,h_id,s_id,g_id)&&teouyg_kontrol(jcb[0].getItemAt(secilen_d), dlm_teouyg.getElementAt(secilen_d))) {
			 int tip=1;
				if(jcb[4].getItemAt(jcb[4].getSelectedIndex())=="Uygulama")
					tip=2;
			try {
				PreparedStatement sorgu=baglanti.prepareStatement("insert into eslestirme(dersid,hocaid,gunid,saatid,tip) values(?,?,?,?,?)");
			     sorgu.setInt(1, d_id);
			     sorgu.setInt(2, h_id);
			     sorgu.setInt(3, g_id);
			     sorgu.setInt(4, s_id);
			     sorgu.setInt(5, tip);
			     sorgu.executeUpdate();
			     listdoldur();
			     frm.combodoldur();
			     frm.listdoldur(frm.jcb_id.getItemAt(0),frm.jcb_orgun.getItemAt(0));
			} catch (Exception e2) {
				JOptionPane.showMessageDialog(this, e2.getMessage());
		      } 	 
		   }
		 else
			 JOptionPane.showMessageDialog(this, "Aynı gün ve aynı saatte ");
		}
	}
	@Override
	public void valueChanged(ListSelectionEvent arg0) {
		JList secilen=(JList)arg0.getSource();
		for(int i=0;i<jlist.length;i++)
			jlist[i].setSelectedIndex(secilen.getSelectedIndex());
		
	}
	@Override
	public void windowActivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowClosed(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowClosing(WindowEvent arg0) {
		frm.setVisible(true);
		
	}
	@Override
	public void windowDeactivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowDeiconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowIconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowOpened(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.sql.*;
public class Hoca extends JFrame implements ActionListener,WindowListener{
      DefaultListModel<String> dlm;
      JList<String> jlist;
      JTextField jtext;
      Calistir frm;
	public Hoca(Calistir frm) {
		 this.frm=frm;
    	 frm.setVisible(false);
		this.setTitle("Hoca");
		this.setSize(150,500);
		this.addWindowListener(this);
		this.setLayout(new FlowLayout());
		
		JPanel jpn=new JPanel();
		jpn.setPreferredSize(new Dimension(150, 500));
        
		dlm=new DefaultListModel<String>();
		jlist=new JList<String>(dlm);
	
		JScrollPane jscp=new JScrollPane(jlist);
		jscp.setPreferredSize(new Dimension(100, 300));
		 
		jtext=new JTextField();
		jtext.setPreferredSize(new Dimension(100, 25));
		
		JButton btn=new JButton("Ekle");
		btn.setPreferredSize(new Dimension(100, 25));
		btn.addActionListener(this);
		JLabel jlb=new JLabel("Hocalar");
		jlb.setPreferredSize(new Dimension(100,25));
	   
		jpn.add(jlb);
		jpn.add(jscp);
		jpn.add(jtext);
		jpn.add(btn);
		listdoldur();
		this.add(jpn);
	    this.setVisible(true);
	}
	Connection baglanti;
    public void baglan() {
    	try {
			baglanti=DriverManager.getConnection("jdbc:sqlite:Ders Programi.db");
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
    	
    }
    public void listdoldur() {
    	try {
			baglan();
			PreparedStatement sorgu=baglanti.prepareStatement("select hocaismi from hoca");
			ResultSet veri=sorgu.executeQuery();
			dlm.clear();
			while(veri.next()) {
				dlm.addElement(veri.getString("hocaismi"));
				
			}
		} catch (Exception e) {
			JOptionPane.showMessageDialog(this, e.getMessage());
		}
    }
	@Override
	public void actionPerformed(ActionEvent arg0) {
	  
		   if(jtext.getText().length()>0) {
    try {
		PreparedStatement sorgu=baglanti.prepareStatement("insert into hoca(hocaismi) values(?)");
		sorgu.setString(1, jtext.getText());
		sorgu.executeUpdate();
		jtext.setText("");
		listdoldur();
	} catch (Exception e) {
		JOptionPane.showMessageDialog(this, e.getMessage());
	}
	}
	}
	@Override
	public void windowActivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowClosed(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowClosing(WindowEvent arg0) {
			frm.setVisible(true);
		
	}
	@Override
	public void windowDeactivated(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowDeiconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowIconified(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void windowOpened(WindowEvent arg0) {
		// TODO Auto-generated method stub
		
	}

}