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