home *** CD-ROM | disk | FTP | other *** search
- import java.applet.Applet;
- import java.awt.BorderLayout;
- import java.awt.Button;
- import java.awt.Checkbox;
- import java.awt.CheckboxGroup;
- import java.awt.Choice;
- import java.awt.Color;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Font;
- import java.awt.GridBagConstraints;
- import java.awt.GridBagLayout;
- import java.awt.GridLayout;
- import java.awt.Image;
- import java.awt.Insets;
- import java.awt.Label;
- import java.awt.LayoutManager;
- import java.awt.MediaTracker;
- import java.awt.Panel;
- import java.awt.TextField;
- import java.awt.event.ActionEvent;
- import java.awt.event.ItemEvent;
- import symantec.itools.awt.TreeNode;
- import symantec.itools.awt.TreeView;
- import symantec.itools.lang.Context;
- import symantec.itools.multimedia.SlideShow;
- import symantec.itools.net.RelativeURL;
-
- public class TreeViewApplet extends Applet {
- Panel panel1;
- Panel panel2;
- Panel panel9;
- TreeView treeView1;
- Panel panel10;
- Panel panel3;
- Label label3;
- TextField textFieldInsert;
- Panel panel6;
- Label label2;
- Checkbox radioButtonChild;
- CheckboxGroup Group1;
- Checkbox radioButtonLast;
- Checkbox radioButtonNext;
- Label label1;
- Label label4;
- Panel panel5;
- Button buttonPrevious;
- SlideShow slideShow1;
- SlideShow slideShow2;
- Button buttonNext;
- Label label5;
- Button buttonInsert;
- Panel panel4;
- Panel panel11;
- Panel panel7;
- Panel panel8;
- Label label8;
- Label label9;
- Label label7;
- Panel panel14;
- Choice choiceTreeColor;
- TextField textFieldStatus;
- TextField textFieldCount;
- Panel panel15;
- Button buttonNew;
- Panel panel13;
- Label label6;
- Label label10;
- TextField textFieldDelete;
- Button buttonDelete;
- Panel panel12;
- Button buttonDeleteSelected;
- TreeNode newNode;
- TreeNode currentNode;
- Image newNodeOpened;
- Image newNodeClosed;
- String openedImageName;
- String closedImageName;
- MediaTracker myImageLoader;
-
- public void init() {
- Context.setApplet(this);
- ((Container)this).setLayout(new BorderLayout(0, 0));
- ((Component)this).setSize(709, 371);
- ((Component)this).setFont(new Font("Dialog", 1, 12));
- ((Component)this).setBackground(Color.magenta);
- this.panel1 = new Panel();
- this.panel1.setLayout(new GridLayout(1, 3, 0, 0));
- this.panel1.setBounds(0, 0, 709, 371);
- this.panel1.setBackground(Color.darkGray);
- ((Container)this).add("Center", this.panel1);
- this.panel2 = new Panel();
- GridBagLayout gridBagLayout = new GridBagLayout();
- this.panel2.setLayout(gridBagLayout);
- this.panel2.setBounds(0, 0, 236, 371);
- this.panel1.add(this.panel2);
- this.panel9 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel9.setLayout(gridBagLayout);
- this.panel9.setBounds(5, 5, 226, 361);
- this.panel9.setBackground(Color.magenta);
- GridBagConstraints gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(5, 5, 5, 5);
- ((GridBagLayout)this.panel2.getLayout()).setConstraints(this.panel9, gbc);
- this.panel2.add(this.panel9);
- this.treeView1 = new TreeView();
- this.treeView1.setLayout((LayoutManager)null);
- String[] tempString = new String[1];
- tempString[0] = new String("root");
- this.treeView1.setTreeStructure(tempString);
- this.treeView1.setBounds(0, 0, 226, 361);
- this.treeView1.setFont(new Font("Dialog", 0, 12));
- this.treeView1.setForeground(Color.black);
- this.treeView1.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel9.getLayout()).setConstraints(this.treeView1, gbc);
- this.panel9.add(this.treeView1);
- this.panel10 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel10.setLayout(gridBagLayout);
- this.panel10.setBounds(236, 0, 236, 371);
- this.panel1.add(this.panel10);
- this.panel3 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel3.setLayout(gridBagLayout);
- this.panel3.setBounds(0, 5, 231, 361);
- this.panel3.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(5, 0, 5, 5);
- ((GridBagLayout)this.panel10.getLayout()).setConstraints(this.panel3, gbc);
- this.panel10.add(this.panel3);
- this.label3 = new Label(" Insert a node with the following name");
- this.label3.setBounds(0, 9, 230, 23);
- this.label3.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label3, gbc);
- this.panel3.add(this.label3);
- this.textFieldInsert = new TextField();
- this.textFieldInsert.setBounds(5, 48, 221, 23);
- this.textFieldInsert.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 5, 0, 5);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.textFieldInsert, gbc);
- this.panel3.add(this.textFieldInsert);
- this.panel6 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel6.setLayout(gridBagLayout);
- this.panel6.setBounds(0, 79, 231, 85);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 2;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.panel6, gbc);
- this.panel3.add(this.panel6);
- this.label2 = new Label(" as the:");
- this.label2.setBounds(20, 2, 57, 23);
- this.label2.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.label2, gbc);
- this.panel6.add(this.label2);
- this.Group1 = new CheckboxGroup();
- this.radioButtonChild = new Checkbox("child", this.Group1, true);
- this.radioButtonChild.setBounds(98, 2, 56, 23);
- this.radioButtonChild.setFont(new Font("Dialog", 0, 12));
- this.radioButtonChild.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 17;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.radioButtonChild, gbc);
- this.panel6.add(this.radioButtonChild);
- this.radioButtonLast = new Checkbox("last sibling", this.Group1, false);
- this.radioButtonLast.setBounds(98, 58, 90, 23);
- this.radioButtonLast.setFont(new Font("Dialog", 0, 12));
- this.radioButtonLast.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 2;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 17;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.radioButtonLast, gbc);
- this.panel6.add(this.radioButtonLast);
- this.radioButtonNext = new Checkbox("next sibling", this.Group1, false);
- this.radioButtonNext.setBounds(98, 30, 92, 23);
- this.radioButtonNext.setFont(new Font("Dialog", 0, 12));
- this.radioButtonNext.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 1;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 17;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel6.getLayout()).setConstraints(this.radioButtonNext, gbc);
- this.panel6.add(this.radioButtonNext);
- this.label1 = new Label(" of the currently selected node");
- this.label1.setBounds(28, 172, 186, 23);
- this.label1.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 5;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 12, 0, 0);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label1, gbc);
- this.panel3.add(this.label1);
- this.label4 = new Label(" The new node will use");
- this.label4.setBounds(38, 211, 155, 23);
- this.label4.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 6;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label4, gbc);
- this.panel3.add(this.label4);
- this.panel5 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel5.setLayout(gridBagLayout);
- this.panel5.setBounds(0, 242, 231, 39);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 7;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.panel5, gbc);
- this.panel3.add(this.panel5);
- this.buttonPrevious = new Button();
- this.buttonPrevious.setLabel("Prev.");
- this.buttonPrevious.setBounds(6, 8, 67, 23);
- this.buttonPrevious.setFont(new Font("Dialog", 1, 12));
- this.buttonPrevious.setForeground(Color.blue);
- this.buttonPrevious.setBackground(Color.lightGray);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 5, 0, 0);
- ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.buttonPrevious, gbc);
- this.panel5.add(this.buttonPrevious);
- this.buttonPrevious.setEnabled(false);
- this.slideShow1 = new SlideShow();
-
- try {
- this.slideShow1.addImageAndDescription(RelativeURL.getURL("arrowclosed.gif"), "");
- this.slideShow1.addImageAndDescription(RelativeURL.getURL("circleclosed.gif"), "");
- this.slideShow1.addImageAndDescription(RelativeURL.getURL("folderclosed.gif"), "");
- this.slideShow1.addImageAndDescription(RelativeURL.getURL("defaultclosed.gif"), "");
- } catch (Exception var14) {
- }
-
- this.slideShow1.setBounds(97, 12, 20, 15);
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 13;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.slideShow1, gbc);
- this.panel5.add(this.slideShow1);
- this.slideShow2 = new SlideShow();
-
- try {
- this.slideShow2.addImageAndDescription(RelativeURL.getURL("arrowopened.gif"), "");
- this.slideShow2.addImageAndDescription(RelativeURL.getURL("circleopened.gif"), "");
- this.slideShow2.addImageAndDescription(RelativeURL.getURL("folderopened.gif"), "");
- this.slideShow2.addImageAndDescription(RelativeURL.getURL("defaultopened.gif"), "");
- } catch (Exception var13) {
- }
-
- this.slideShow2.setBounds(117, 12, 20, 15);
- gbc = new GridBagConstraints();
- gbc.gridx = 2;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 17;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.slideShow2, gbc);
- this.panel5.add(this.slideShow2);
- this.buttonNext = new Button();
- this.buttonNext.setLabel("Next");
- this.buttonNext.setBounds(161, 8, 64, 23);
- this.buttonNext.setFont(new Font("Dialog", 1, 12));
- this.buttonNext.setForeground(Color.blue);
- this.buttonNext.setBackground(Color.lightGray);
- gbc = new GridBagConstraints();
- gbc.gridx = 3;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 0, 0, 5);
- ((GridBagLayout)this.panel5.getLayout()).setConstraints(this.buttonNext, gbc);
- this.panel5.add(this.buttonNext);
- this.label5 = new Label(" as its images");
- this.label5.setBounds(63, 289, 104, 23);
- this.label5.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 8;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.label5, gbc);
- this.panel3.add(this.label5);
- this.buttonInsert = new Button();
- this.buttonInsert.setLabel("Insert");
- this.buttonInsert.setBounds(5, 328, 221, 23);
- this.buttonInsert.setFont(new Font("Dialog", 1, 12));
- this.buttonInsert.setForeground(Color.blue);
- this.buttonInsert.setBackground(Color.lightGray);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 9;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 5, 0, 5);
- ((GridBagLayout)this.panel3.getLayout()).setConstraints(this.buttonInsert, gbc);
- this.panel3.add(this.buttonInsert);
- this.panel4 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel4.setLayout(gridBagLayout);
- this.panel4.setBounds(472, 0, 236, 371);
- this.panel1.add(this.panel4);
- this.panel11 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel11.setLayout(gridBagLayout);
- this.panel11.setBounds(0, 5, 231, 101);
- this.panel11.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(5, 0, 0, 5);
- ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel11, gbc);
- this.panel4.add(this.panel11);
- this.panel7 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel7.setLayout(gridBagLayout);
- this.panel7.setBounds(5, 0, 221, 101);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(0, 5, 0, 5);
- ((GridBagLayout)this.panel11.getLayout()).setConstraints(this.panel7, gbc);
- this.panel11.add(this.panel7);
- this.panel8 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel8.setLayout(gridBagLayout);
- this.panel8.setBounds(0, 0, 69, 101);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.gridheight = 2;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel7.getLayout()).setConstraints(this.panel8, gbc);
- this.panel7.add(this.panel8);
- this.label8 = new Label("tree color");
- this.label8.setBounds(0, 6, 69, 23);
- this.label8.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 17;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel8.getLayout()).setConstraints(this.label8, gbc);
- this.panel8.add(this.label8);
- this.label9 = new Label("status");
- this.label9.setBounds(0, 39, 69, 23);
- this.label9.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 17;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel8.getLayout()).setConstraints(this.label9, gbc);
- this.panel8.add(this.label9);
- this.label7 = new Label("# nodes");
- this.label7.setBounds(0, 72, 69, 23);
- this.label7.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 2;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.anchor = 17;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel8.getLayout()).setConstraints(this.label7, gbc);
- this.panel8.add(this.label7);
- this.panel14 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel14.setLayout(gridBagLayout);
- this.panel14.setBounds(69, 0, 151, 101);
- gbc = new GridBagConstraints();
- gbc.gridx = 1;
- gbc.gridy = 0;
- gbc.weightx = (double)10.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel7.getLayout()).setConstraints(this.panel14, gbc);
- this.panel7.add(this.panel14);
- this.choiceTreeColor = new Choice();
- this.choiceTreeColor.addItem("black");
- this.choiceTreeColor.addItem("blue");
- this.choiceTreeColor.addItem("red");
- this.choiceTreeColor.addItem("green");
- this.choiceTreeColor.addItem("yellow");
- this.choiceTreeColor.addItem("orange");
- this.choiceTreeColor.addItem("purple");
- this.choiceTreeColor.setBounds(0, 5, 151, 21);
- this.choiceTreeColor.setFont(new Font("Dialog", 0, 12));
- this.choiceTreeColor.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel14.getLayout()).setConstraints(this.choiceTreeColor, gbc);
- this.panel14.add(this.choiceTreeColor);
- this.textFieldStatus = new TextField();
- this.textFieldStatus.setEditable(false);
- this.textFieldStatus.setText("waiting for input");
- this.textFieldStatus.setBounds(0, 37, 151, 23);
- this.textFieldStatus.setFont(new Font("Dialog", 0, 12));
- this.textFieldStatus.setForeground(Color.gray);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel14.getLayout()).setConstraints(this.textFieldStatus, gbc);
- this.panel14.add(this.textFieldStatus);
- this.textFieldCount = new TextField();
- this.textFieldCount.setEditable(false);
- this.textFieldCount.setText("1");
- this.textFieldCount.setBounds(0, 71, 151, 23);
- this.textFieldCount.setFont(new Font("Dialog", 0, 12));
- this.textFieldCount.setForeground(Color.gray);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 2;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel14.getLayout()).setConstraints(this.textFieldCount, gbc);
- this.panel14.add(this.textFieldCount);
- this.panel15 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel15.setLayout(gridBagLayout);
- this.panel15.setBounds(0, 111, 231, 65);
- this.panel15.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(5, 0, 5, 5);
- ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel15, gbc);
- this.panel4.add(this.panel15);
- this.buttonNew = new Button();
- this.buttonNew.setLabel("Create New Tree");
- this.buttonNew.setBounds(5, 21, 221, 23);
- this.buttonNew.setFont(new Font("Dialog", 1, 12));
- this.buttonNew.setForeground(new Color(-16744320));
- this.buttonNew.setBackground(Color.lightGray);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(5, 5, 5, 5);
- ((GridBagLayout)this.panel15.getLayout()).setConstraints(this.buttonNew, gbc);
- this.panel15.add(this.buttonNew);
- this.panel13 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel13.setLayout(gridBagLayout);
- this.panel13.setBounds(0, 181, 231, 124);
- this.panel13.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 2;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(0, 0, 0, 5);
- ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel13, gbc);
- this.panel4.add(this.panel13);
- this.label6 = new Label(" Delete the first node encountered");
- this.label6.setBounds(13, 4, 205, 23);
- this.label6.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.label6, gbc);
- this.panel13.add(this.label6);
- this.label10 = new Label(" with the following name");
- this.label10.setBounds(39, 35, 152, 23);
- this.label10.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 1;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 0;
- gbc.insets = new Insets(0, 0, 0, 0);
- ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.label10, gbc);
- this.panel13.add(this.label10);
- this.textFieldDelete = new TextField();
- this.textFieldDelete.setBounds(5, 66, 221, 23);
- this.textFieldDelete.setFont(new Font("Dialog", 0, 12));
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 2;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 5, 0, 5);
- ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.textFieldDelete, gbc);
- this.panel13.add(this.textFieldDelete);
- this.buttonDelete = new Button();
- this.buttonDelete.setLabel("Delete");
- this.buttonDelete.setBounds(5, 97, 221, 23);
- this.buttonDelete.setFont(new Font("Dialog", 1, 12));
- this.buttonDelete.setForeground(Color.red);
- this.buttonDelete.setBackground(Color.lightGray);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 3;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 5, 0, 5);
- ((GridBagLayout)this.panel13.getLayout()).setConstraints(this.buttonDelete, gbc);
- this.panel13.add(this.buttonDelete);
- this.panel12 = new Panel();
- gridBagLayout = new GridBagLayout();
- this.panel12.setLayout(gridBagLayout);
- this.panel12.setBounds(0, 310, 231, 55);
- this.panel12.setBackground(Color.white);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 3;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 1;
- gbc.insets = new Insets(5, 0, 5, 5);
- ((GridBagLayout)this.panel4.getLayout()).setConstraints(this.panel12, gbc);
- this.panel4.add(this.panel12);
- this.buttonDeleteSelected = new Button();
- this.buttonDeleteSelected.setLabel("Delete selected node");
- this.buttonDeleteSelected.setBounds(5, 16, 221, 23);
- this.buttonDeleteSelected.setFont(new Font("Dialog", 1, 12));
- this.buttonDeleteSelected.setForeground(Color.red);
- this.buttonDeleteSelected.setBackground(Color.lightGray);
- gbc = new GridBagConstraints();
- gbc.gridx = 0;
- gbc.gridy = 0;
- gbc.weightx = (double)1.0F;
- gbc.weighty = (double)1.0F;
- gbc.fill = 2;
- gbc.insets = new Insets(0, 5, 0, 5);
- ((GridBagLayout)this.panel12.getLayout()).setConstraints(this.buttonDeleteSelected, gbc);
- this.panel12.add(this.buttonDeleteSelected);
- this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
- Image tempImage1 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "arrowclosed.gif");
- Image tempImage2 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "arrowopened.gif");
- Image tempImage3 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "folderclosed.gif");
- Image tempImage4 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "folderopened.gif");
- Image tempImage5 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "circleclosed.gif");
- Image tempImage6 = ((Applet)this).getImage(((Applet)this).getDocumentBase(), "circleopened.gif");
- this.myImageLoader = new MediaTracker(this.treeView1);
-
- try {
- this.myImageLoader.addImage(tempImage1, 1);
- this.myImageLoader.addImage(tempImage2, 1);
- this.myImageLoader.addImage(tempImage3, 1);
- this.myImageLoader.addImage(tempImage4, 1);
- this.myImageLoader.addImage(tempImage5, 1);
- this.myImageLoader.addImage(tempImage6, 1);
- this.myImageLoader.waitForAll();
- } catch (Exception e) {
- System.out.println(e);
- }
-
- TreeViewApplet$SymAction lSymAction = new TreeViewApplet$SymAction(this);
- this.buttonDeleteSelected.addActionListener(lSymAction);
- this.buttonDelete.addActionListener(lSymAction);
- this.buttonInsert.addActionListener(lSymAction);
- this.buttonNext.addActionListener(lSymAction);
- this.buttonPrevious.addActionListener(lSymAction);
- TreeViewApplet$SymItem lSymItem = new TreeViewApplet$SymItem(this);
- this.choiceTreeColor.addItemListener(lSymItem);
- this.buttonNew.addActionListener(lSymAction);
- }
-
- void buttonDeleteSelected_Action(ActionEvent event) {
- this.treeView1.removeSelected();
- this.treeView1.repaint();
- this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
- this.textFieldStatus.setText("node deleted");
- if (this.textFieldCount.getText().equals("0")) {
- this.textFieldStatus.setText("press: Create New Tree");
- }
-
- }
-
- void buttonDelete_Action(ActionEvent event) {
- this.treeView1.remove(this.textFieldDelete.getText());
- this.treeView1.repaint();
- this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
- this.textFieldStatus.setText("node deleted");
- if (this.textFieldCount.getText().equals("0")) {
- this.textFieldStatus.setText("press: Create New Tree");
- }
-
- }
-
- void buttonInsert_Action(ActionEvent event) {
- this.updateImage();
- this.newNodeClosed = ((Applet)this).getImage(((Applet)this).getDocumentBase(), this.closedImageName);
- this.newNodeOpened = ((Applet)this).getImage(((Applet)this).getDocumentBase(), this.openedImageName);
- int selectedRadioButton = 0;
- if (this.radioButtonChild.getState()) {
- selectedRadioButton = 0;
- }
-
- if (this.radioButtonNext.getState()) {
- selectedRadioButton = 1;
- }
-
- if (this.radioButtonLast.getState()) {
- selectedRadioButton = 2;
- }
-
- String newNodeText = this.textFieldInsert.getText();
- this.newNode = new TreeNode(newNodeText, this.newNodeClosed, this.newNodeOpened, this.treeView1);
- this.currentNode = this.treeView1.getSelectedNode();
- this.treeView1.insert(this.newNode, this.currentNode, selectedRadioButton);
- this.treeView1.redraw();
- this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
- this.textFieldStatus.setText("node inserted");
- }
-
- void updateImage() {
- int selectedImage = this.slideShow1.getCurrentImageIndex();
- if (selectedImage == 0) {
- this.openedImageName = "arrowopened.gif";
- this.closedImageName = "arrowclosed.gif";
- this.buttonPrevious.setEnabled(false);
- } else if (selectedImage == 1) {
- this.openedImageName = "circleopened.gif";
- this.closedImageName = "circleclosed.gif";
- this.buttonPrevious.setEnabled(true);
- } else if (selectedImage == 2) {
- this.openedImageName = "folderopened.gif";
- this.closedImageName = "folderclosed.gif";
- this.buttonNext.setEnabled(true);
- } else {
- this.openedImageName = null;
- this.closedImageName = null;
- this.buttonNext.setEnabled(false);
- }
-
- }
-
- void buttonNext_Action(ActionEvent event) {
- this.slideShow2.nextImage();
- this.slideShow1.nextImage();
- this.updateImage();
- this.textFieldStatus.setText("choosing image");
- }
-
- void buttonPrevious_Action(ActionEvent event) {
- this.slideShow2.previousImage();
- this.slideShow1.previousImage();
- this.updateImage();
- this.textFieldStatus.setText("choosing image");
- }
-
- void buttonNew_Action(ActionEvent event) {
- String[] tempString = new String[1];
- tempString[0] = new String("root");
- this.treeView1.setTreeStructure(tempString);
- this.textFieldCount.setText(String.valueOf(this.treeView1.getCount()));
- this.textFieldStatus.setText("new tree created");
- }
-
- void choiceTreeColor_ItemStateChanged(ItemEvent event) {
- String selectedColor = this.choiceTreeColor.getSelectedItem();
- if (selectedColor == "black") {
- this.treeView1.setForeground(Color.black);
- } else if (selectedColor == "blue") {
- this.treeView1.setForeground(Color.blue);
- } else if (selectedColor == "red") {
- this.treeView1.setForeground(Color.red);
- } else if (selectedColor == "green") {
- this.treeView1.setForeground(Color.green);
- } else if (selectedColor == "yellow") {
- this.treeView1.setForeground(Color.yellow);
- } else if (selectedColor == "orange") {
- this.treeView1.setForeground(Color.orange);
- } else if (selectedColor == "purple") {
- this.treeView1.setForeground(Color.magenta);
- }
-
- this.treeView1.redraw();
- }
- }
-