// create the spinner
final SpinnerThread spinner = new SpinnerThread();
//create a frame and button
JFrame frame = new JFrame();
JButton button = new JButton("Stop");
frame.getContentPane().add(button);
frame.pack();
// hook up an action to stop the spinner and quit
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
spinner.quit();
}
});
// start'er up!
spinner.start();
frame.show();