rendered paste bodyimport java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;
public class Test
{
public float Ptr;
public boolean Boo1;
public Test()
{
Ptr = 00.0f;
Boo1 = true;
}
public void run()
{
while (Ptr <= 99.9f && Boo1 == true)
{
Ptr += 0.1f;
try {
Thread.sleep(1000);
//1000 millisecs
}
catch(InterruptedException ex) {
}
}
}
public void stop()
{
Boo1 = false;
}
public void face()
{
JFrame frame = new JFrame("button");
Container contentPane = frame.getContentPane();
JButton button1 = new JButton("stop");
button1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { stop();
} });
contentPane.add(button1);
}
}