home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 January / maximum-cd-1999-01.iso / Symantec Visual Cafe / WDESAMPL.BIN / treeview.jar / TreeViewApplet.class (.txt) next >
Encoding:
Java Class File  |  1998-02-18  |  16.7 KB  |  793 lines

  1. import java.applet.Applet;
  2. import java.awt.BorderLayout;
  3. import java.awt.Button;
  4. import java.awt.Checkbox;
  5. import java.awt.CheckboxGroup;
  6. import java.awt.Choice;
  7. import java.awt.Color;
  8. import java.awt.Component;
  9. import java.awt.Container;
  10. import java.awt.Font;
  11. import java.awt.GridBagConstraints;
  12. import java.awt.GridBagLayout;
  13. import java.awt.GridLayout;
  14. import java.awt.Image;
  15. import java.awt.Insets;
  16. import java.awt.Label;
  17. import java.awt.LayoutManager;
  18. import java.awt.MediaTracker;
  19. import java.awt.Panel;
  20. import java.awt.TextField;
  21. import java.awt.event.ActionEvent;
  22. import java.awt.event.ItemEvent;
  23. import symantec.itools.awt.TreeNode;
  24. import symantec.itools.awt.TreeView;
  25. import symantec.itools.lang.Context;
  26. import symantec.itools.multimedia.SlideShow;
  27. import symantec.itools.net.RelativeURL;
  28.  
  29. public class TreeViewApplet extends Applet {
  30.    Panel panel1;
  31.    Panel panel2;
  32.    Panel panel9;
  33.    TreeView treeView1;
  34.    Panel panel10;
  35.    Panel panel3;
  36.    Label label3;
  37.    TextField textFieldInsert;
  38.    Panel panel6;
  39.    Label label2;
  40.    Checkbox radioButtonChild;
  41.    CheckboxGroup Group1;
  42.    Checkbox radioButtonLast;
  43.    Checkbox radioButtonNext;
  44.    Label label1;
  45.    Label label4;
  46.    Panel panel5;
  47.    Button buttonPrevious;
  48.    SlideShow slideShow1;
  49.    SlideShow slideShow2;
  50.    Button buttonNext;
  51.    Label label5;
  52.    Button buttonInsert;
  53.    Panel panel4;
  54.    Panel panel11;
  55.    Panel panel7;
  56.    Panel panel8;
  57.    Label label8;
  58.    Label label9;
  59.    Label label7;
  60.    Panel panel14;
  61.    Choice choiceTreeColor;
  62.    TextField textFieldStatus;
  63.    TextField textFieldCount;
  64.    Panel panel15;
  65.    Button buttonNew;
  66.    Panel panel13;
  67.    Label label6;
  68.    Label label10;
  69.    TextField textFieldDelete;
  70.    Button buttonDelete;
  71.    Panel panel12;
  72.    Button buttonDeleteSelected;
  73.    TreeNode newNode;
  74.    TreeNode currentNode;
  75.    Image newNodeOpened;
  76.    Image newNodeClosed;
  77.    String openedImageName;
  78.    String closedImageName;
  79.    MediaTracker myImageLoader;
  80.  
  81.    public void init() {
  82.       Context.setApplet(this);
  83.       ((Container)this).setLayout(new BorderLayout(0, 0));
  84.       ((Component)this).setSize(709, 371);
  85.       ((Component)this).setFont(new Font("Dialog", 1, 12));
  86.       ((Component)this).setBackground(Color.magenta);
  87.       this.panel1 = new Panel();
  88.       this.panel1.setLayout(new GridLayout(1, 3, 0, 0));
  89.       this.panel1.setBounds(0, 0, 709, 371);
  90.       this.panel1.setBackground(Color.darkGray);
  91.       ((Container)this).add("Center", this.panel1);
  92.       this.panel2 = new Panel();
  93.       GridBagLayout gridBagLayout = new GridBagLayout();
  94.       this.panel2.setLayout(gridBagLayout);
  95.       this.panel2.setBounds(0, 0, 236, 371);
  96.       this.panel1.add(this.panel2);
  97.       this.panel9 = new Panel();
  98.       gridBagLayout = new GridBagLayout();
  99.       this.panel9.setLayout(gridBagLayout);
  100.       this.panel9.setBounds(5, 5, 226, 361);
  101.       this.panel9.setBackground(Color.magenta);
  102.       GridBagConstraints gbc = new GridBagConstraints();
  103.       gbc.gridx = 0;
  104.       gbc.gridy = 0;
  105.       gbc.weightx = (double)1.0F;
  106.       gbc.weighty = (double)1.0F;
  107.       gbc.fill = 1;
  108.       gbc.insets = new Insets(5, 5, 5, 5);
  109.       ((GridBagLayout)this.panel2.getLayout()).setConstraints(this.panel9, gbc);
  110.       this.panel2.add(this.panel9);
  111.       this.treeView1 = new TreeView();
  112.       this.treeView1.setLayout((LayoutManager)null);
  113.       String[] tempString = new String[1];
  114.       tempString[0] = new String("root");
  115.       this.treeView1.setTreeStructure(tempString);
  116.       this.treeView1.setBounds(0, 0, 226, 361);
  117.       this.treeView1.setFont(new Font("Dialog", 0, 12));
  118.       this.treeView1.setForeground(Color.black);
  119.       this.treeView1.setBackground(Color.white);
  120.       gbc = new GridBagConstraints();
  121.       gbc.gridx = 0;
  122.       gbc.gridy = 0;
  123.       gbc.weightx = (double)1.0F;
  124.       gbc.weighty = (double)1.0F;
  125.       gbc.fill = 1;
  126.       gbc.insets = new Insets(0, 0, 0, 0);
  127.       ((GridBagLayout)this.panel9.getLayout()).setConstraints(this.treeView1, gbc);
  128.       this.panel9.add(this.treeView1);
  129.       this.panel10 = new Panel();
  130.       gridBagLayout = new GridBagLayout();
  131.       this.panel10.setLayout(gridBagLayout);
  132.       this.panel10.setBounds(236, 0, 236, 371);
  133.       this.panel1.add(this.panel10);
  134.       this.panel3 = new Panel();
  135.       gridBagLayout = new GridBagLayout();
  136.       this.panel3.setLayout(gridBagLayout);
  137.       this.panel3.setBounds(0, 5, 231, 361);
  138.       this.panel3.setBackground(Color.white);
  139.       gbc = new GridBagConstraints();
  140.       gbc.gridx = 0;
  141.       gbc.gridy = 0;
  142.       gbc.weightx = (double)1.0F;
  143.       gbc.weighty = (double)1.0F;
  144.       gbc.fill = 1;
  145.       gbc.insets = new Insets(5, 0, 5, 5);
  146.       ((GridBagLayout)this.panel10.getLayout()).setConstraints(this.panel3, gbc);
  147.       this.panel10.add(this.panel3);
  148.       this.label3 = new Label("    Insert a node with the following name");
  149.       this.label3.setBounds(0, 9, 230, 23);
  150.       this.label3.setFont(new Font("Dialog", 0, 12));
  151.       gbc = new GridBagConstraints();
  152.       gbc.gridx = 0;
  153.       gbc.gridy = 0;
  154.       gbc.weightx = (double)1.0F;
  155.       gbc.weighty = (double)1.0F;
  156.       gbc.fill = 0;
  157.       gbc.insets = new Insets(0, 0, 0, 0);
  158.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label3, gbc);
  159.       this.panel3.add(this.label3);
  160.       this.textFieldInsert = new TextField();
  161.       this.textFieldInsert.setBounds(5, 48, 221, 23);
  162.       this.textFieldInsert.setFont(new Font("Dialog", 0, 12));
  163.       gbc = new GridBagConstraints();
  164.       gbc.gridx = 0;
  165.       gbc.gridy = 1;
  166.       gbc.weightx = (double)1.0F;
  167.       gbc.weighty = (double)1.0F;
  168.       gbc.fill = 2;
  169.       gbc.insets = new Insets(0, 5, 0, 5);
  170.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.textFieldInsert, gbc);
  171.       this.panel3.add(this.textFieldInsert);
  172.       this.panel6 = new Panel();
  173.       gridBagLayout = new GridBagLayout();
  174.       this.panel6.setLayout(gridBagLayout);
  175.       this.panel6.setBounds(0, 79, 231, 85);
  176.       gbc = new GridBagConstraints();
  177.       gbc.gridx = 0;
  178.       gbc.gridy = 2;
  179.       gbc.weightx = (double)1.0F;
  180.       gbc.weighty = (double)1.0F;
  181.       gbc.fill = 1;
  182.       gbc.insets = new Insets(0, 0, 0, 0);
  183.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.panel6, gbc);
  184.       this.panel3.add(this.panel6);
  185.       this.label2 = new Label("  as the:");
  186.       this.label2.setBounds(20, 2, 57, 23);
  187.       this.label2.setFont(new Font("Dialog", 0, 12));
  188.       gbc = new GridBagConstraints();
  189.       gbc.gridx = 0;
  190.       gbc.gridy = 0;
  191.       gbc.weightx = (double)1.0F;
  192.       gbc.weighty = (double)1.0F;
  193.       gbc.fill = 0;
  194.       gbc.insets = new Insets(0, 0, 0, 0);
  195.       ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.label2, gbc);
  196.       this.panel6.add(this.label2);
  197.       this.Group1 = new CheckboxGroup();
  198.       this.radioButtonChild = new Checkbox("child", this.Group1, true);
  199.       this.radioButtonChild.setBounds(98, 2, 56, 23);
  200.       this.radioButtonChild.setFont(new Font("Dialog", 0, 12));
  201.       this.radioButtonChild.setBackground(Color.white);
  202.       gbc = new GridBagConstraints();
  203.       gbc.gridx = 1;
  204.       gbc.gridy = 0;
  205.       gbc.weightx = (double)1.0F;
  206.       gbc.weighty = (double)1.0F;
  207.       gbc.anchor = 17;
  208.       gbc.fill = 0;
  209.       gbc.insets = new Insets(0, 0, 0, 0);
  210.       ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.radioButtonChild, gbc);
  211.       this.panel6.add(this.radioButtonChild);
  212.       this.radioButtonLast = new Checkbox("last sibling", this.Group1, false);
  213.       this.radioButtonLast.setBounds(98, 58, 90, 23);
  214.       this.radioButtonLast.setFont(new Font("Dialog", 0, 12));
  215.       this.radioButtonLast.setBackground(Color.white);
  216.       gbc = new GridBagConstraints();
  217.       gbc.gridx = 1;
  218.       gbc.gridy = 2;
  219.       gbc.weightx = (double)1.0F;
  220.       gbc.weighty = (double)1.0F;
  221.       gbc.anchor = 17;
  222.       gbc.fill = 0;
  223.       gbc.insets = new Insets(0, 0, 0, 0);
  224.       ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.radioButtonLast, gbc);
  225.       this.panel6.add(this.radioButtonLast);
  226.       this.radioButtonNext = new Checkbox("next sibling", this.Group1, false);
  227.       this.radioButtonNext.setBounds(98, 30, 92, 23);
  228.       this.radioButtonNext.setFont(new Font("Dialog", 0, 12));
  229.       this.radioButtonNext.setBackground(Color.white);
  230.       gbc = new GridBagConstraints();
  231.       gbc.gridx = 1;
  232.       gbc.gridy = 1;
  233.       gbc.weightx = (double)1.0F;
  234.       gbc.weighty = (double)1.0F;
  235.       gbc.anchor = 17;
  236.       gbc.fill = 0;
  237.       gbc.insets = new Insets(0, 0, 0, 0);
  238.       ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.radioButtonNext, gbc);
  239.       this.panel6.add(this.radioButtonNext);
  240.       this.label1 = new Label("    of the currently selected node");
  241.       this.label1.setBounds(28, 172, 186, 23);
  242.       this.label1.setFont(new Font("Dialog", 0, 12));
  243.       gbc = new GridBagConstraints();
  244.       gbc.gridx = 0;
  245.       gbc.gridy = 5;
  246.       gbc.weightx = (double)1.0F;
  247.       gbc.weighty = (double)1.0F;
  248.       gbc.fill = 0;
  249.       gbc.insets = new Insets(0, 12, 0, 0);
  250.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label1, gbc);
  251.       this.panel3.add(this.label1);
  252.       this.label4 = new Label("      The new node will use");
  253.       this.label4.setBounds(38, 211, 155, 23);
  254.       this.label4.setFont(new Font("Dialog", 0, 12));
  255.       gbc = new GridBagConstraints();
  256.       gbc.gridx = 0;
  257.       gbc.gridy = 6;
  258.       gbc.weightx = (double)1.0F;
  259.       gbc.weighty = (double)1.0F;
  260.       gbc.fill = 0;
  261.       gbc.insets = new Insets(0, 0, 0, 0);
  262.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label4, gbc);
  263.       this.panel3.add(this.label4);
  264.       this.panel5 = new Panel();
  265.       gridBagLayout = new GridBagLayout();
  266.       this.panel5.setLayout(gridBagLayout);
  267.       this.panel5.setBounds(0, 242, 231, 39);
  268.       gbc = new GridBagConstraints();
  269.       gbc.gridx = 0;
  270.       gbc.gridy = 7;
  271.       gbc.weightx = (double)1.0F;
  272.       gbc.weighty = (double)1.0F;
  273.       gbc.fill = 1;
  274.       gbc.insets = new Insets(0, 0, 0, 0);
  275.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.panel5, gbc);
  276.       this.panel3.add(this.panel5);
  277.       this.buttonPrevious = new Button();
  278.       this.buttonPrevious.setLabel("Prev.");
  279.       this.buttonPrevious.setBounds(6, 8, 67, 23);
  280.       this.buttonPrevious.setFont(new Font("Dialog", 1, 12));
  281.       this.buttonPrevious.setForeground(Color.blue);
  282.       this.buttonPrevious.setBackground(Color.lightGray);
  283.       gbc = new GridBagConstraints();
  284.       gbc.gridx = 0;
  285.       gbc.gridy = 0;
  286.       gbc.weightx = (double)1.0F;
  287.       gbc.weighty = (double)1.0F;
  288.       gbc.fill = 2;
  289.       gbc.insets = new Insets(0, 5, 0, 0);
  290.       ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.buttonPrevious, gbc);
  291.       this.panel5.add(this.buttonPrevious);
  292.       this.buttonPrevious.setEnabled(false);
  293.       this.slideShow1 = new SlideShow();
  294.  
  295.       try {
  296.          this.slideShow1.addImageAndDescription(RelativeURL.getURL("arrowclosed.gif"), "");
  297.          this.slideShow1.addImageAndDescription(RelativeURL.getURL("circleclosed.gif"), "");
  298.          this.slideShow1.addImageAndDescription(RelativeURL.getURL("folderclosed.gif"), "");
  299.          this.slideShow1.addImageAndDescription(RelativeURL.getURL("defaultclosed.gif"), "");
  300.       } catch (Exception var14) {
  301.       }
  302.  
  303.       this.slideShow1.setBounds(97, 12, 20, 15);
  304.       gbc = new GridBagConstraints();
  305.       gbc.gridx = 1;
  306.       gbc.gridy = 0;
  307.       gbc.weightx = (double)1.0F;
  308.       gbc.weighty = (double)1.0F;
  309.       gbc.anchor = 13;
  310.       gbc.fill = 0;
  311.       gbc.insets = new Insets(0, 0, 0, 0);
  312.       ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.slideShow1, gbc);
  313.       this.panel5.add(this.slideShow1);
  314.       this.slideShow2 = new SlideShow();
  315.  
  316.       try {
  317.          this.slideShow2.addImageAndDescription(RelativeURL.getURL("arrowopened.gif"), "");
  318.          this.slideShow2.addImageAndDescription(RelativeURL.getURL("circleopened.gif"), "");
  319.          this.slideShow2.addImageAndDescription(RelativeURL.getURL("folderopened.gif"), "");
  320.          this.slideShow2.addImageAndDescription(RelativeURL.getURL("defaultopened.gif"), "");
  321.       } catch (Exception var13) {
  322.       }
  323.  
  324.       this.slideShow2.setBounds(117, 12, 20, 15);
  325.       gbc = new GridBagConstraints();
  326.       gbc.gridx = 2;
  327.       gbc.gridy = 0;
  328.       gbc.weightx = (double)1.0F;
  329.       gbc.weighty = (double)1.0F;
  330.       gbc.anchor = 17;
  331.       gbc.fill = 0;
  332.       gbc.insets = new Insets(0, 0, 0, 0);
  333.       ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.slideShow2, gbc);
  334.       this.panel5.add(this.slideShow2);
  335.       this.buttonNext = new Button();
  336.       this.buttonNext.setLabel("Next");
  337.       this.buttonNext.setBounds(161, 8, 64, 23);
  338.       this.buttonNext.setFont(new Font("Dialog", 1, 12));
  339.       this.buttonNext.setForeground(Color.blue);
  340.       this.buttonNext.setBackground(Color.lightGray);
  341.       gbc = new GridBagConstraints();
  342.       gbc.gridx = 3;
  343.       gbc.gridy = 0;
  344.       gbc.weightx = (double)1.0F;
  345.       gbc.weighty = (double)1.0F;
  346.       gbc.fill = 2;
  347.       gbc.insets = new Insets(0, 0, 0, 5);
  348.       ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.buttonNext, gbc);
  349.       this.panel5.add(this.buttonNext);
  350.       this.label5 = new Label("     as its images");
  351.       this.label5.setBounds(63, 289, 104, 23);
  352.       this.label5.setFont(new Font("Dialog", 0, 12));
  353.       gbc = new GridBagConstraints();
  354.       gbc.gridx = 0;
  355.       gbc.gridy = 8;
  356.       gbc.weightx = (double)1.0F;
  357.       gbc.weighty = (double)1.0F;
  358.       gbc.fill = 0;
  359.       gbc.insets = new Insets(0, 0, 0, 0);
  360.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label5, gbc);
  361.       this.panel3.add(this.label5);
  362.       this.buttonInsert = new Button();
  363.       this.buttonInsert.setLabel("Insert");
  364.       this.buttonInsert.setBounds(5, 328, 221, 23);
  365.       this.buttonInsert.setFont(new Font("Dialog", 1, 12));
  366.       this.buttonInsert.setForeground(Color.blue);
  367.       this.buttonInsert.setBackground(Color.lightGray);
  368.       gbc = new GridBagConstraints();
  369.       gbc.gridx = 0;
  370.       gbc.gridy = 9;
  371.       gbc.weightx = (double)1.0F;
  372.       gbc.weighty = (double)1.0F;
  373.       gbc.fill = 2;
  374.       gbc.insets = new Insets(0, 5, 0, 5);
  375.       ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.buttonInsert, gbc);
  376.       this.panel3.add(this.buttonInsert);
  377.       this.panel4 = new Panel();
  378.       gridBagLayout = new GridBagLayout();
  379.       this.panel4.setLayout(gridBagLayout);
  380.       this.panel4.setBounds(472, 0, 236, 371);
  381.       this.panel1.add(this.panel4);
  382.       this.panel11 = new Panel();
  383.       gridBagLayout = new GridBagLayout();
  384.       this.panel11.setLayout(gridBagLayout);
  385.       this.panel11.setBounds(0, 5, 231, 101);
  386.       this.panel11.setBackground(Color.white);
  387.       gbc = new GridBagConstraints();
  388.       gbc.gridx = 0;
  389.       gbc.gridy = 0;
  390.       gbc.weightx = (double)1.0F;
  391.       gbc.weighty = (double)1.0F;
  392.       gbc.fill = 1;
  393.       gbc.insets = new Insets(5, 0, 0, 5);
  394.       ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel11, gbc);
  395.       this.panel4.add(this.panel11);
  396.       this.panel7 = new Panel();
  397.       gridBagLayout = new GridBagLayout();
  398.       this.panel7.setLayout(gridBagLayout);
  399.       this.panel7.setBounds(5, 0, 221, 101);
  400.       gbc = new GridBagConstraints();
  401.       gbc.gridx = 0;
  402.       gbc.gridy = 0;
  403.       gbc.weightx = (double)1.0F;
  404.       gbc.weighty = (double)1.0F;
  405.       gbc.fill = 1;
  406.       gbc.insets = new Insets(0, 5, 0, 5);
  407.       ((GridBagLayout)this.panel11.getLayout()).setConstraints(this.panel7, gbc);
  408.       this.panel11.add(this.panel7);
  409.       this.panel8 = new Panel();
  410.       gridBagLayout = new GridBagLayout();
  411.       this.panel8.setLayout(gridBagLayout);
  412.       this.panel8.setBounds(0, 0, 69, 101);
  413.       gbc = new GridBagConstraints();
  414.       gbc.gridx = 0;
  415.       gbc.gridy = 0;
  416.       gbc.gridheight = 2;
  417.       gbc.weightx = (double)1.0F;
  418.       gbc.weighty = (double)1.0F;
  419.       gbc.fill = 1;
  420.       gbc.insets = new Insets(0, 0, 0, 0);
  421.       ((GridBagLayout)this.panel7.getLayout()).setConstraints(this.panel8, gbc);
  422.       this.panel7.add(this.panel8);
  423.       this.label8 = new Label("tree color");
  424.       this.label8.setBounds(0, 6, 69, 23);
  425.       this.label8.setFont(new Font("Dialog", 0, 12));
  426.       gbc = new GridBagConstraints();
  427.       gbc.gridx = 0;
  428.       gbc.gridy = 0;
  429.       gbc.weightx = (double)1.0F;
  430.       gbc.weighty = (double)1.0F;
  431.       gbc.anchor = 17;
  432.       gbc.fill = 2;
  433.       gbc.insets = new Insets(0, 0, 0, 0);
  434.       ((GridBagLayout)this.panel8.getLayout()).setConstraints(this.label8, gbc);
  435.       this.panel8.add(this.label8);
  436.       this.label9 = new Label("status");
  437.       this.label9.setBounds(0, 39, 69, 23);
  438.       this.label9.setFont(new Font("Dialog", 0, 12));
  439.       gbc = new GridBagConstraints();
  440.       gbc.gridx = 0;
  441.       gbc.gridy = 1;
  442.       gbc.weightx = (double)1.0F;
  443.       gbc.weighty = (double)1.0F;
  444.       gbc.anchor = 17;
  445.       gbc.fill = 2;
  446.       gbc.insets = new Insets(0, 0, 0, 0);
  447.       ((GridBagLayout)this.panel8.getLayout()).setConstraints(this.label9, gbc);
  448.       this.panel8.add(this.label9);
  449.       this.label7 = new Label("# nodes");
  450.       this.label7.setBounds(0, 72, 69, 23);
  451.       this.label7.setFont(new Font("Dialog", 0, 12));
  452.       gbc = new GridBagConstraints();
  453.       gbc.gridx = 0;
  454.       gbc.gridy = 2;
  455.       gbc.weightx = (double)1.0F;
  456.       gbc.weighty = (double)1.0F;
  457.       gbc.anchor = 17;
  458.       gbc.fill = 2;
  459.       gbc.insets = new Insets(0, 0, 0, 0);
  460.       ((GridBagLayout)this.panel8.getLayout()).setConstraints(this.label7, gbc);
  461.       this.panel8.add(this.label7);
  462.       this.panel14 = new Panel();
  463.       gridBagLayout = new GridBagLayout();
  464.       this.panel14.setLayout(gridBagLayout);
  465.       this.panel14.setBounds(69, 0, 151, 101);
  466.       gbc = new GridBagConstraints();
  467.       gbc.gridx = 1;
  468.       gbc.gridy = 0;
  469.       gbc.weightx = (double)10.0F;
  470.       gbc.weighty = (double)1.0F;
  471.       gbc.fill = 1;
  472.       gbc.insets = new Insets(0, 0, 0, 0);
  473.       ((GridBagLayout)this.panel7.getLayout()).setConstraints(this.panel14, gbc);
  474.       this.panel7.add(this.panel14);
  475.       this.choiceTreeColor = new Choice();
  476.       this.choiceTreeColor.addItem("black");
  477.       this.choiceTreeColor.addItem("blue");
  478.       this.choiceTreeColor.addItem("red");
  479.       this.choiceTreeColor.addItem("green");
  480.       this.choiceTreeColor.addItem("yellow");
  481.       this.choiceTreeColor.addItem("orange");
  482.       this.choiceTreeColor.addItem("purple");
  483.       this.choiceTreeColor.setBounds(0, 5, 151, 21);
  484.       this.choiceTreeColor.setFont(new Font("Dialog", 0, 12));
  485.       this.choiceTreeColor.setBackground(Color.white);
  486.       gbc = new GridBagConstraints();
  487.       gbc.gridx = 0;
  488.       gbc.gridy = 0;
  489.       gbc.weightx = (double)1.0F;
  490.       gbc.weighty = (double)1.0F;
  491.       gbc.fill = 2;
  492.       gbc.insets = new Insets(0, 0, 0, 0);
  493.       ((GridBagLayout)this.panel14.getLayout()).setConstraints(this.choiceTreeColor, gbc);
  494.       this.panel14.add(this.choiceTreeColor);
  495.       this.textFieldStatus = new TextField();
  496.       this.textFieldStatus.setEditable(false);
  497.       this.textFieldStatus.setText("waiting for input");
  498.       this.textFieldStatus.setBounds(0, 37, 151, 23);
  499.       this.textFieldStatus.setFont(new Font("Dialog", 0, 12));
  500.       this.textFieldStatus.setForeground(Color.gray);
  501.       gbc = new GridBagConstraints();
  502.       gbc.gridx = 0;
  503.       gbc.gridy = 1;
  504.       gbc.weightx = (double)1.0F;
  505.       gbc.weighty = (double)1.0F;
  506.       gbc.fill = 2;
  507.       gbc.insets = new Insets(0, 0, 0, 0);
  508.       ((GridBagLayout)this.panel14.getLayout()).setConstraints(this.textFieldStatus, gbc);
  509.       this.panel14.add(this.textFieldStatus);
  510.       this.textFieldCount = new TextField();
  511.       this.textFieldCount.setEditable(false);
  512.       this.textFieldCount.setText("1");
  513.       this.textFieldCount.setBounds(0, 71, 151, 23);
  514.       this.textFieldCount.setFont(new Font("Dialog", 0, 12));
  515.       this.textFieldCount.setForeground(Color.gray);
  516.       gbc = new GridBagConstraints();
  517.       gbc.gridx = 0;
  518.       gbc.gridy = 2;
  519.       gbc.weightx = (double)1.0F;
  520.       gbc.weighty = (double)1.0F;
  521.       gbc.fill = 2;
  522.       gbc.insets = new Insets(0, 0, 0, 0);
  523.       ((GridBagLayout)this.panel14.getLayout()).setConstraints(this.textFieldCount, gbc);
  524.       this.panel14.add(this.textFieldCount);
  525.       this.panel15 = new Panel();
  526.       gridBagLayout = new GridBagLayout();
  527.       this.panel15.setLayout(gridBagLayout);
  528.       this.panel15.setBounds(0, 111, 231, 65);
  529.       this.panel15.setBackground(Color.white);
  530.       gbc = new GridBagConstraints();
  531.       gbc.gridx = 0;
  532.       gbc.gridy = 1;
  533.       gbc.weightx = (double)1.0F;
  534.       gbc.weighty = (double)1.0F;
  535.       gbc.fill = 1;
  536.       gbc.insets = new Insets(5, 0, 5, 5);
  537.       ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel15, gbc);
  538.       this.panel4.add(this.panel15);
  539.       this.buttonNew = new Button();
  540.       this.buttonNew.setLabel("Create New Tree");
  541.       this.buttonNew.setBounds(5, 21, 221, 23);
  542.       this.buttonNew.setFont(new Font("Dialog", 1, 12));
  543.       this.buttonNew.setForeground(new Color(-16744320));
  544.       this.buttonNew.setBackground(Color.lightGray);
  545.       gbc = new GridBagConstraints();
  546.       gbc.gridx = 0;
  547.       gbc.gridy = 0;
  548.       gbc.weightx = (double)1.0F;
  549.       gbc.weighty = (double)1.0F;
  550.       gbc.fill = 2;
  551.       gbc.insets = new Insets(5, 5, 5, 5);
  552.       ((GridBagLayout)this.panel15.getLayout()).setConstraints(this.buttonNew, gbc);
  553.       this.panel15.add(this.buttonNew);
  554.       this.panel13 = new Panel();
  555.       gridBagLayout = new GridBagLayout();
  556.       this.panel13.setLayout(gridBagLayout);
  557.       this.panel13.setBounds(0, 181, 231, 124);
  558.       this.panel13.setBackground(Color.white);
  559.       gbc = new GridBagConstraints();
  560.       gbc.gridx = 0;
  561.       gbc.gridy = 2;
  562.       gbc.weightx = (double)1.0F;
  563.       gbc.weighty = (double)1.0F;
  564.       gbc.fill = 1;
  565.       gbc.insets = new Insets(0, 0, 0, 5);
  566.       ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel13, gbc);
  567.       this.panel4.add(this.panel13);
  568.       this.label6 = new Label("   Delete the first node encountered");
  569.       this.label6.setBounds(13, 4, 205, 23);
  570.       this.label6.setFont(new Font("Dialog", 0, 12));
  571.       gbc = new GridBagConstraints();
  572.       gbc.gridx = 0;
  573.       gbc.gridy = 0;
  574.       gbc.weightx = (double)1.0F;
  575.       gbc.weighty = (double)1.0F;
  576.       gbc.fill = 0;
  577.       gbc.insets = new Insets(0, 0, 0, 0);
  578.       ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.label6, gbc);
  579.       this.panel13.add(this.label6);
  580.       this.label10 = new Label("   with the following name");
  581.       this.label10.setBounds(39, 35, 152, 23);
  582.       this.label10.setFont(new Font("Dialog", 0, 12));
  583.       gbc = new GridBagConstraints();
  584.       gbc.gridx = 0;
  585.       gbc.gridy = 1;
  586.       gbc.weightx = (double)1.0F;
  587.       gbc.weighty = (double)1.0F;
  588.       gbc.fill = 0;
  589.       gbc.insets = new Insets(0, 0, 0, 0);
  590.       ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.label10, gbc);
  591.       this.panel13.add(this.label10);
  592.       this.textFieldDelete = new TextField();
  593.       this.textFieldDelete.setBounds(5, 66, 221, 23);
  594.       this.textFieldDelete.setFont(new Font("Dialog", 0, 12));
  595.       gbc = new GridBagConstraints();
  596.       gbc.gridx = 0;
  597.       gbc.gridy = 2;
  598.       gbc.weightx = (double)1.0F;
  599.       gbc.weighty = (double)1.0F;
  600.       gbc.fill = 2;
  601.       gbc.insets = new Insets(0, 5, 0, 5);
  602.       ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.textFieldDelete, gbc);
  603.       this.panel13.add(this.textFieldDelete);
  604.       this.buttonDelete = new Button();
  605.       this.buttonDelete.setLabel("Delete");
  606.       this.buttonDelete.setBounds(5, 97, 221, 23);
  607.       this.buttonDelete.setFont(new Font("Dialog", 1, 12));
  608.       this.buttonDelete.setForeground(Color.red);
  609.       this.buttonDelete.setBackground(Color.lightGray);
  610.       gbc = new GridBagConstraints();
  611.       gbc.gridx = 0;
  612.       gbc.gridy = 3;
  613.       gbc.weightx = (double)1.0F;
  614.       gbc.weighty = (double)1.0F;
  615.       gbc.fill = 2;
  616.       gbc.insets = new Insets(0, 5, 0, 5);
  617.       ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.buttonDelete, gbc);
  618.       this.panel13.add(this.buttonDelete);
  619.       this.panel12 = new Panel();
  620.       gridBagLayout = new GridBagLayout();
  621.       this.panel12.setLayout(gridBagLayout);
  622.       this.panel12.setBounds(0, 310, 231, 55);
  623.       this.panel12.setBackground(Color.white);
  624.       gbc = new GridBagConstraints();
  625.       gbc.gridx = 0;
  626.       gbc.gridy = 3;
  627.       gbc.weightx = (double)1.0F;
  628.       gbc.weighty = (double)1.0F;
  629.       gbc.fill = 1;
  630.       gbc.insets = new Insets(5, 0, 5, 5);
  631.       ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel12, gbc);
  632.       this.panel4.add(this.panel12);
  633.       this.buttonDeleteSelected = new Button();
  634.       this.buttonDeleteSelected.setLabel("Delete selected node");
  635.       this.buttonDeleteSelected.setBounds(5, 16, 221, 23);
  636.       this.buttonDeleteSelected.setFont(new Font("Dialog", 1, 12));
  637.       this.buttonDeleteSelected.setForeground(Color.red);
  638.       this.buttonDeleteSelected.setBackground(Color.lightGray);
  639.       gbc = new GridBagConstraints();
  640.       gbc.gridx = 0;
  641.       gbc.gridy = 0;
  642.       gbc.weightx = (double)1.0F;
  643.       gbc.weighty = (double)1.0F;
  644.       gbc.fill = 2;
  645.       gbc.insets = new Insets(0, 5, 0, 5);
  646.       ((GridBagLayout)this.panel12.getLayout()).setConstraints(this.buttonDeleteSelected, gbc);
  647.       this.panel12.add(this.buttonDeleteSelected);
  648.       this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
  649.       Image tempImage1 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "arrowclosed.gif");
  650.       Image tempImage2 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "arrowopened.gif");
  651.       Image tempImage3 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "folderclosed.gif");
  652.       Image tempImage4 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "folderopened.gif");
  653.       Image tempImage5 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "circleclosed.gif");
  654.       Image tempImage6 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "circleopened.gif");
  655.       this.myImageLoader = new MediaTracker(this.treeView1);
  656.  
  657.       try {
  658.          this.myImageLoader.addImage(tempImage1, 1);
  659.          this.myImageLoader.addImage(tempImage2, 1);
  660.          this.myImageLoader.addImage(tempImage3, 1);
  661.          this.myImageLoader.addImage(tempImage4, 1);
  662.          this.myImageLoader.addImage(tempImage5, 1);
  663.          this.myImageLoader.addImage(tempImage6, 1);
  664.          this.myImageLoader.waitForAll();
  665.       } catch (Exception e) {
  666.          System.out.println(e);
  667.       }
  668.  
  669.       TreeViewApplet$SymAction lSymAction = new TreeViewApplet$SymAction(this);
  670.       this.buttonDeleteSelected.addActionListener(lSymAction);
  671.       this.buttonDelete.addActionListener(lSymAction);
  672.       this.buttonInsert.addActionListener(lSymAction);
  673.       this.buttonNext.addActionListener(lSymAction);
  674.       this.buttonPrevious.addActionListener(lSymAction);
  675.       TreeViewApplet$SymItem lSymItem = new TreeViewApplet$SymItem(this);
  676.       this.choiceTreeColor.addItemListener(lSymItem);
  677.       this.buttonNew.addActionListener(lSymAction);
  678.    }
  679.  
  680.    void buttonDeleteSelected_Action(ActionEvent event) {
  681.       this.treeView1.removeSelected();
  682.       this.treeView1.repaint();
  683.       this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
  684.       this.textFieldStatus.setText("node deleted");
  685.       if (this.textFieldCount.getText().equals("0")) {
  686.          this.textFieldStatus.setText("press: Create New Tree");
  687.       }
  688.  
  689.    }
  690.  
  691.    void buttonDelete_Action(ActionEvent event) {
  692.       this.treeView1.remove(this.textFieldDelete.getText());
  693.       this.treeView1.repaint();
  694.       this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
  695.       this.textFieldStatus.setText("node deleted");
  696.       if (this.textFieldCount.getText().equals("0")) {
  697.          this.textFieldStatus.setText("press: Create New Tree");
  698.       }
  699.  
  700.    }
  701.  
  702.    void buttonInsert_Action(ActionEvent event) {
  703.       this.updateImage();
  704.       this.newNodeClosed = ((Applet)this).getImage(((Applet)this).getDocumentBase(), this.closedImageName);
  705.       this.newNodeOpened = ((Applet)this).getImage(((Applet)this).getDocumentBase(), this.openedImageName);
  706.       int selectedRadioButton = 0;
  707.       if (this.radioButtonChild.getState()) {
  708.          selectedRadioButton = 0;
  709.       }
  710.  
  711.       if (this.radioButtonNext.getState()) {
  712.          selectedRadioButton = 1;
  713.       }
  714.  
  715.       if (this.radioButtonLast.getState()) {
  716.          selectedRadioButton = 2;
  717.       }
  718.  
  719.       String newNodeText = this.textFieldInsert.getText();
  720.       this.newNode = new TreeNode(newNodeText, this.newNodeClosed, this.newNodeOpened, this.treeView1);
  721.       this.currentNode = this.treeView1.getSelectedNode();
  722.       this.treeView1.insert(this.newNode, this.currentNode, selectedRadioButton);
  723.       this.treeView1.redraw();
  724.       this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
  725.       this.textFieldStatus.setText("node inserted");
  726.    }
  727.  
  728.    void updateImage() {
  729.       int selectedImage = this.slideShow1.getCurrentImageIndex();
  730.       if (selectedImage == 0) {
  731.          this.openedImageName = "arrowopened.gif";
  732.          this.closedImageName = "arrowclosed.gif";
  733.          this.buttonPrevious.setEnabled(false);
  734.       } else if (selectedImage == 1) {
  735.          this.openedImageName = "circleopened.gif";
  736.          this.closedImageName = "circleclosed.gif";
  737.          this.buttonPrevious.setEnabled(true);
  738.       } else if (selectedImage == 2) {
  739.          this.openedImageName = "folderopened.gif";
  740.          this.closedImageName = "folderclosed.gif";
  741.          this.buttonNext.setEnabled(true);
  742.       } else {
  743.          this.openedImageName = null;
  744.          this.closedImageName = null;
  745.          this.buttonNext.setEnabled(false);
  746.       }
  747.  
  748.    }
  749.  
  750.    void buttonNext_Action(ActionEvent event) {
  751.       this.slideShow2.nextImage();
  752.       this.slideShow1.nextImage();
  753.       this.updateImage();
  754.       this.textFieldStatus.setText("choosing image");
  755.    }
  756.  
  757.    void buttonPrevious_Action(ActionEvent event) {
  758.       this.slideShow2.previousImage();
  759.       this.slideShow1.previousImage();
  760.       this.updateImage();
  761.       this.textFieldStatus.setText("choosing image");
  762.    }
  763.  
  764.    void buttonNew_Action(ActionEvent event) {
  765.       String[] tempString = new String[1];
  766.       tempString[0] = new String("root");
  767.       this.treeView1.setTreeStructure(tempString);
  768.       this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
  769.       this.textFieldStatus.setText("new tree created");
  770.    }
  771.  
  772.    void choiceTreeColor_ItemStateChanged(ItemEvent event) {
  773.       String selectedColor = this.choiceTreeColor.getSelectedItem();
  774.       if (selectedColor == "black") {
  775.          this.treeView1.setForeground(Color.black);
  776.       } else if (selectedColor == "blue") {
  777.          this.treeView1.setForeground(Color.blue);
  778.       } else if (selectedColor == "red") {
  779.          this.treeView1.setForeground(Color.red);
  780.       } else if (selectedColor == "green") {
  781.          this.treeView1.setForeground(Color.green);
  782.       } else if (selectedColor == "yellow") {
  783.          this.treeView1.setForeground(Color.yellow);
  784.       } else if (selectedColor == "orange") {
  785.          this.treeView1.setForeground(Color.orange);
  786.       } else if (selectedColor == "purple") {
  787.          this.treeView1.setForeground(Color.magenta);
  788.       }
  789.  
  790.       this.treeView1.redraw();
  791.    }
  792. }
  793.