import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ornek extends JFrame implements ActionListener,Runnable {
Container cont;
Thread th;
JButton btn;
JLabel lab;
JTextField tf;
public ornek(Strng title){
super(title);
cont=getContentPane();
th=new Thread(this);
btn=new JButton("tikla..");
btn.addActionListener(this);
lab=new JLabel("count : ");
tf=new JTextField(20);
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent we){
System.exit(0);
}
});
cont.add(lab);
cont.add(tf);
cont.add(btn);
cont.setLayout(new FlowLayout());
}
public void run(){
try{
for(int i=0;i<100;i++){
tf.setText(""+i);
th.sleep(300);
}
}
catch(Exception ex){
System.out.println("Exception name : "+ex);
}
}
public void actionPerformed(ActionEvent ae){
try{
if(ae.getSource()==btn){
th.start();
}
}
catch(Exception ex){
System.out.println("Exception name : "+ex);
}
}
public static void main(String args[]){
ornek or=new ornek("ornek..");
or.pack();
or.setVisible(true);
}
}