~ubuntu-branches/ubuntu/trusty/libswingx-java/trusty

« back to all changes in this revision

Viewing changes to src/demo/org/jdesktop/swingx/JXTaskPaneDemo.java

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2008-03-08 16:18:24 UTC
  • Revision ID: james.westby@ubuntu.com-20080308161824-wsahvl9pwzjcea3g
Tags: upstream-0.9.2
ImportĀ upstreamĀ versionĀ 0.9.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * $Id: JXTaskPaneDemo.java,v 1.1 2007/03/21 03:51:00 rbair Exp $
 
3
 *
 
4
 * Copyright 2006 Sun Microsystems, Inc., 4150 Network Circle,
 
5
 * Santa Clara, California 95054, U.S.A. All rights reserved.
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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
 
20
 */
 
21
 
 
22
package org.jdesktop.swingx;
 
23
 
 
24
import java.awt.BorderLayout;
 
25
import java.awt.event.ActionEvent;
 
26
import javax.swing.*;
 
27
 
 
28
import org.jdesktop.swingx.action.AbstractActionExt;
 
29
 
 
30
/**
 
31
 *
 
32
 * Quick demo of the JXTaskPane
 
33
 *
 
34
 * @author rbair
 
35
 */
 
36
public class JXTaskPaneDemo extends JPanel {
 
37
 
 
38
    public JXTaskPaneDemo() {
 
39
        setLayout(new BorderLayout());
 
40
        
 
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);
 
48
        
 
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);
 
56
        
 
57
        taskPane = new JXTaskPane();
 
58
        taskPane.setTitle("Notes");
 
59
        taskPane.add(new JScrollPane(new JTextArea(15, 20)));
 
60
        container.add(taskPane);
 
61
        
 
62
        add(new JScrollPane(container));
 
63
    }
 
64
    
 
65
    private static final class TODOAction extends AbstractActionExt {
 
66
        public TODOAction(String name) {
 
67
            setName(name);
 
68
        }
 
69
        public void actionPerformed(ActionEvent actionEvent) {}
 
70
    }
 
71
    
 
72
    public static void main(String[] args) {
 
73
        SwingUtilities.invokeLater(new Runnable() {
 
74
            public void run() {
 
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);
 
81
            }
 
82
        });
 
83
    }
 
84
    
 
85
}