import java.awt.event.*;
import javax.swing.*;
public class SinavaYonelik extends JFrame {
private JTextArea area;
private JTextField tf1;
private JTextField tf2;
private JTextField tf3;
private int kayitSayisi = 0;
private JLabel durum;
public SinavaYonelik() {
super("sinav");
init();
}
private void init() {
setLayout(null);
setBounds(275,190,500,500);
JLabel ad = new JLabel("AD");
JLabel soyad = new JLabel("SOYAD");
JLabel tel = new JLabel("TEL");
durum = new JLabel("KAYIT YOK");
tf1 = new JTextField();
tf2 = new JTextField();
tf3 = new JTextField();
JMenuBar bar=new JMenuBar();
JMenu dosya = new JMenu("DOSYA");
JMenu yardim = new JMenu("YARDIM");
JMenuItem cikis = new JMenuItem("ÇIKIŞ");
cikis.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
System.exit(0);
}
});
JMenuItem hakkinda =new JMenuItem("HAKKINDA");
hakkinda.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
JOptionPane.showMessageDialog(null,"AD SOYAD NO");
}
});
area = new JTextArea();
JScrollPane pane = new JScrollPane(area);
JButton kayit = new JButton("KAYIT");
kayit.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent arg0) {
if(!tf1.getText().equals("") && !tf2.getText().equals("") && !tf3.getText().equals("")){
area.append(tf1.getText() + "
" + tf2.getText() + "
" + tf3.getText() + "
" + "
");
kayitSayisi++;
durum.setText(kayitSayisi + "kayit sayısı var");
tf1.setText("");
tf2.setText("");
tf3.setText("");
area.setEditable(false);
}
}
});
dosya.add(cikis);
yardim.add(hakkinda);
bar.add(dosya);
bar.add(yardim);
setJMenuBar(bar);
ad.setBounds(40,90,80,20);
soyad.setBounds(40,130,80,20);
tel.setBounds(40,170,80,20);
tf1.setBounds(85,90,80,20);
tf2.setBounds(85,130,80,20);
tf3.setBounds(85,170,80,20);
durum.setBounds(40,300,160,20);
pane.setBounds(200,80,150,150);
kayit.setBounds(250,300,80,20);
JPanel win = (JPanel) getContentPane();
win.add(ad);
win.add(soyad);
win.add(tel);
win.add(tf1);
win.add(tf2);
win.add(tf3);
win.add(durum);
win.add(pane);
win.add(kayit);
}
public static void main(String[] args) {
new SinavaYonelik().setVisible(true);
}
}
|