View Javadoc

1   /*
2    *  File: SwingExampleLauncher.java 
3    *  Copyright (c) 2004-2009  Peter Kliem (Peter.Kliem@jaret.de)
4    *  A commercial license is available, see http://www.jaret.de.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation; either version 2 of the License, or
9    *  (at your option) any later version.
10   *
11   *  This program is distributed in the hope that it will be useful,
12   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   *  GNU General Public License for more details.
15   *
16   *  You should have received a copy of the GNU General Public License
17   *  along with this program; if not, write to the Free Software
18   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19   */
20  package de.jaret.examples.timebars;
21  
22  import java.awt.Container;
23  import java.awt.GridLayout;
24  import java.awt.event.ActionEvent;
25  import java.awt.event.ActionListener;
26  
27  import javax.swing.JButton;
28  import javax.swing.JFrame;
29  import javax.swing.event.SwingPropertyChangeSupport;
30  
31  import de.jaret.examples.timebars.calendar.swing.SwingCalendarExample;
32  import de.jaret.examples.timebars.eventmonitoring.swing.EventMonitoringExample;
33  import de.jaret.examples.timebars.events.swing.SwingEventExample;
34  import de.jaret.examples.timebars.hierarchy.swing.SwingHierarchy;
35  import de.jaret.examples.timebars.pdi.swing.PdiExample;
36  import de.jaret.examples.timebars.scheduling.swing.SwingSchedulingExample;
37  import de.jaret.examples.timebars.simple.swing.SwingOverlapExample;
38  
39  /***
40   * Simple launcher for the swing examples to be used with OS X. The launcher should be started by ANT to avoid threading problems
41   * that prevent mixed SWT and Swing code to work properly under OS X.
42   * 
43   * @author kliem
44   * @version $Id$
45   */
46  public class SwingExampleLauncher {
47      public static void main(String[] args) {
48      	JFrame f = new JFrame(SwingEventExample.class.getName());
49          f.setSize(800, 500);
50          f.getContentPane().setLayout(new GridLayout(10, 1));
51          f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
52  
53          addLaunchButtons(f.getContentPane());
54          
55          
56          f.setVisible(true);
57      }
58  
59  	private static void addLaunchButtons(Container contentPane) {
60  		JButton b = new JButton();
61  		b.setText("Hierarchy");
62  		b.addActionListener(new ActionListener() {
63  			
64  			public void actionPerformed(ActionEvent e) {
65  				SwingHierarchy.main(new String[0]);
66  			}
67  		});
68  		contentPane.add(b);
69  
70  		b = new JButton();
71  		b.setText("Events");
72  		b.addActionListener(new ActionListener() {
73  			
74  			public void actionPerformed(ActionEvent e) {
75  				SwingEventExample.main(new String[0]);
76  			}
77  		});
78  		contentPane.add(b);
79  
80  		b = new JButton();
81  		b.setText("Overlap");
82  		b.addActionListener(new ActionListener() {
83  			
84  			public void actionPerformed(ActionEvent e) {
85  				SwingOverlapExample.main(new String[0]);
86  			}
87  		});
88  		contentPane.add(b);
89  
90          b = new JButton();
91          b.setText("EventMonitoring");
92          b.addActionListener(new ActionListener() {
93              
94              public void actionPerformed(ActionEvent e) {
95                  EventMonitoringExample.main(new String[0]);
96              }
97          });
98          contentPane.add(b);
99  
100         b = new JButton();
101         b.setText("Schedule");
102         b.addActionListener(new ActionListener() {
103             
104             public void actionPerformed(ActionEvent e) {
105                 SwingSchedulingExample.main(new String[0]);
106             }
107         });
108         contentPane.add(b);
109 
110         b = new JButton();
111         b.setText("PDI");
112         b.addActionListener(new ActionListener() {
113             
114             public void actionPerformed(ActionEvent e) {
115                 PdiExample.main(new String[0]);
116             }
117         });
118         contentPane.add(b);
119 
120         b = new JButton();
121         b.setText("Calendar");
122         b.addActionListener(new ActionListener() {
123             
124             public void actionPerformed(ActionEvent e) {
125                 SwingCalendarExample.main(new String[0]);
126             }
127         });
128         contentPane.add(b);
129 
130 	}
131 }