2
* $Id: JXTaskPaneDemo.java,v 1.1 2007/03/21 03:51:00 rbair Exp $
4
* Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle,
5
* Santa Clara, California 95054, U.S.A. All rights reserved.
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Lesser General Public
9
* License as published by the Free Software Foundation; either
10
* version 2.1 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Lesser General Public License for more details.
17
* You should have received a copy of the GNU Lesser General Public
18
* License along with this library; if not, write to the Free Software
19
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
package org.jdesktop.swingx;
24
import java.awt.BorderLayout;
25
import java.awt.event.ActionEvent;
28
import org.jdesktop.swingx.action.AbstractActionExt;
32
* Quick demo of the JXTaskPane
36
public class JXTaskPaneDemo extends JPanel {
38
public JXTaskPaneDemo() {
39
setLayout(new BorderLayout());
41
JXTaskPaneContainer container = new JXTaskPaneContainer();
42
JXTaskPane taskPane = new JXTaskPane();
43
taskPane.setTitle("TODO Tasks");
44
taskPane.add(new TODOAction("Prepare slides for JavaPolis"));
45
taskPane.add(new TODOAction("Buy Christmas presents"));
46
taskPane.add(new TODOAction("Meet with Brian about SwingLabs"));
47
container.add(taskPane);
49
taskPane = new JXTaskPane();
50
taskPane.setTitle("Key Dates");
51
taskPane.add(new TODOAction("December 25"));
52
taskPane.add(new TODOAction("January 1"));
53
taskPane.add(new TODOAction("Febuary 14"));
54
taskPane.add(new TODOAction("March 26"));
55
container.add(taskPane);
57
taskPane = new JXTaskPane();
58
taskPane.setTitle("Notes");
59
taskPane.add(new JScrollPane(new JTextArea(15, 20)));
60
container.add(taskPane);
62
add(new JScrollPane(container));
65
private static final class TODOAction extends AbstractActionExt {
66
public TODOAction(String name) {
69
public void actionPerformed(ActionEvent actionEvent) {}
72
public static void main(String[] args) {
73
SwingUtilities.invokeLater(new Runnable() {
75
JFrame frame = new JFrame();
76
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
77
frame.setLocationRelativeTo(null);
78
frame.setSize(400, 400);
79
frame.add(new JXTaskPaneDemo());
80
frame.setVisible(true);