01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.tests;
15:
16: import org.jetbrains.annotations.NotNull;
17:
18: import javax.swing.*;
19: import java.awt.*;
20: import java.awt.event.ActionEvent;
21: import java.awt.event.ActionListener;
22:
23: /**
24: * User: Martin
25: * Date: 03.03.2006
26: * Time: 16:48:34
27: */
28: @SuppressWarnings({"ALL"})
29: public class ThreadExitTest {
30: public static void main(@NotNull
31: String[] args) {
32: final JFrame frame = new JFrame();
33: JButton button = new JButton("dispose");
34: button.addActionListener(new ActionListener() {
35: public void actionPerformed(@NotNull
36: ActionEvent e) {
37: frame.dispose();
38: }
39: });
40:
41: frame.getContentPane().add(button, BorderLayout.CENTER);
42: frame.pack();
43: frame.setVisible(true);
44:
45: Timer timer = new Timer(100, new ActionListener() {
46: public void actionPerformed(@NotNull
47: ActionEvent e) {
48: System.out.println("ThreadExitTest.actionPerformed");
49: }
50: });
51:
52: timer.setRepeats(true);
53: timer.start();
54:
55: //Thread t = new Thread(new Runnable()
56: //{
57: // public void run()
58: // {
59: // while(true)
60: // {
61: // try
62: // {
63: // synchronized(this)
64: // {
65: // wait(1000);
66: // }
67: // //Thread.sleep(1000);
68: // System.out.println("ThreadExitTest.run");
69: // }
70: // catch (InterruptedException e)
71: // {
72: // e.printStackTrace();
73: // }
74: // }
75: // }
76: //});
77: //
78: //t.setDaemon(true);
79: //t.start();
80: }
81: }
|