2
|
1 |
/*
|
5506
|
2 |
* Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
|
2
|
3 |
*
|
|
4 |
* Redistribution and use in source and binary forms, with or without
|
|
5 |
* modification, are permitted provided that the following conditions
|
|
6 |
* are met:
|
|
7 |
*
|
|
8 |
* - Redistributions of source code must retain the above copyright
|
|
9 |
* notice, this list of conditions and the following disclaimer.
|
|
10 |
*
|
|
11 |
* - Redistributions in binary form must reproduce the above copyright
|
|
12 |
* notice, this list of conditions and the following disclaimer in the
|
|
13 |
* documentation and/or other materials provided with the distribution.
|
|
14 |
*
|
5506
|
15 |
* - Neither the name of Oracle nor the names of its
|
2
|
16 |
* contributors may be used to endorse or promote products derived
|
|
17 |
* from this software without specific prior written permission.
|
|
18 |
*
|
|
19 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
20 |
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
21 |
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
22 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
23 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
24 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
25 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
26 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
27 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
28 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
29 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
30 |
*/
|
|
31 |
|
|
32 |
/*
|
|
33 |
*/
|
|
34 |
|
|
35 |
import java.awt.*;
|
|
36 |
import java.awt.event.*;
|
|
37 |
import java.util.*;
|
|
38 |
import javax.swing.*;
|
|
39 |
import javax.swing.border.*;
|
|
40 |
import javax.swing.tree.*;
|
|
41 |
|
|
42 |
|
|
43 |
/**
|
|
44 |
* This is a subclass of JInternalFrame which displays a tree.
|
|
45 |
*
|
|
46 |
* @author Steve Wilson
|
|
47 |
*/
|
|
48 |
public class MetalworksInBox extends JInternalFrame {
|
|
49 |
|
|
50 |
public MetalworksInBox() {
|
|
51 |
super("In Box", true, true, true, true);
|
|
52 |
|
|
53 |
DefaultMutableTreeNode unread;
|
|
54 |
DefaultMutableTreeNode personal;
|
|
55 |
DefaultMutableTreeNode business;
|
|
56 |
DefaultMutableTreeNode spam;
|
|
57 |
|
|
58 |
DefaultMutableTreeNode top = new DefaultMutableTreeNode("Mail Boxes");
|
|
59 |
|
|
60 |
top.add( unread = new DefaultMutableTreeNode("Unread Mail") );
|
|
61 |
top.add( personal = new DefaultMutableTreeNode("Personal") );
|
|
62 |
top.add( business = new DefaultMutableTreeNode("Business") );
|
|
63 |
top.add( spam = new DefaultMutableTreeNode("Spam") );
|
|
64 |
|
|
65 |
unread.add( new DefaultMutableTreeNode("Buy Stuff Now") );
|
|
66 |
unread.add( new DefaultMutableTreeNode("Read Me Now") );
|
|
67 |
unread.add( new DefaultMutableTreeNode("Hot Offer") );
|
|
68 |
unread.add( new DefaultMutableTreeNode("Re: Re: Thank You") );
|
|
69 |
unread.add( new DefaultMutableTreeNode("Fwd: Good Joke") );
|
|
70 |
|
|
71 |
personal.add( new DefaultMutableTreeNode("Hi") );
|
|
72 |
personal.add( new DefaultMutableTreeNode("Good to hear from you") );
|
|
73 |
personal.add( new DefaultMutableTreeNode("Re: Thank You") );
|
|
74 |
|
|
75 |
business.add( new DefaultMutableTreeNode("Thanks for your order") );
|
|
76 |
business.add( new DefaultMutableTreeNode("Price Quote") );
|
|
77 |
business.add( new DefaultMutableTreeNode("Here is the invoice") );
|
|
78 |
business.add( new DefaultMutableTreeNode("Project Metal: delivered on time") );
|
|
79 |
business.add( new DefaultMutableTreeNode("Your salary raise approved") );
|
|
80 |
|
|
81 |
spam.add( new DefaultMutableTreeNode("Buy Now") );
|
|
82 |
spam.add( new DefaultMutableTreeNode("Make $$$ Now") );
|
|
83 |
spam.add( new DefaultMutableTreeNode("HOT HOT HOT") );
|
|
84 |
spam.add( new DefaultMutableTreeNode("Buy Now") );
|
|
85 |
spam.add( new DefaultMutableTreeNode("Don't Miss This") );
|
|
86 |
spam.add( new DefaultMutableTreeNode("Opportunity in Precious Metals") );
|
|
87 |
spam.add( new DefaultMutableTreeNode("Buy Now") );
|
|
88 |
spam.add( new DefaultMutableTreeNode("Last Chance") );
|
|
89 |
spam.add( new DefaultMutableTreeNode("Buy Now") );
|
|
90 |
spam.add( new DefaultMutableTreeNode("Make $$$ Now") );
|
|
91 |
spam.add( new DefaultMutableTreeNode("To Hot To Handle") );
|
|
92 |
spam.add( new DefaultMutableTreeNode("I'm waiting for your call") );
|
|
93 |
|
|
94 |
JTree tree = new JTree(top);
|
|
95 |
JScrollPane treeScroller = new JScrollPane(tree);
|
|
96 |
treeScroller.setBackground(tree.getBackground());
|
|
97 |
setContentPane(treeScroller);
|
|
98 |
setSize( 325, 200);
|
|
99 |
setLocation( 75, 75);
|
|
100 |
|
|
101 |
}
|
|
102 |
|
|
103 |
|
|
104 |
|
|
105 |
}
|