AMS_Memory thisksp = (AMS_Memory) memories.get((String)obj); System.out.println("thisksp "+thisksp); JInternalFrame jp = new PETScViewKSP(thisksp);
AMS_Memory thismem = (AMS_Memory) memories.get((String)obj); System.out.println("thismem "+thismem); JInternalFrame jp; String oclass = mem.get_field("Class").getStringData()[0]; if (oclass.equals("KSP")) { jp = new PETScViewKSP(thismem); } else if (oclass.equals("SNES")) { jp = new PETScViewSNES(thismem); } else return;
  public void displayoptionsset() { /*---------------------------------------------*/    /*            Clear the window of old options    */    System.out.println("About to remove panels");        japplet.removeAll();    japplet.setVisible(false);    System.out.println("Removed panel; trying to get objects");        japplet.setLayout(new BorderLayout());            /* Create a Panel that  will contain two buttons. Default layout manager */    JPanel bpanel = new JPanel(new GridLayout(1,4));            JButton button = new JButton("Refresh");    bpanel.add(button);    button.addActionListener(new RefreshActionListener());    JButton qbutton = new JButton("Quit GUI");    bpanel.add(qbutton);    qbutton.addActionListener(new QuitActionListener());            /* Add the Panel in the top of the Frame */    japplet.add(bpanel, BorderLayout.NORTH);            /* Add panel to right for displaying output */    rpanel = new JDesktopPane();    rpanel.setVisible(true);    /*   rpanel.setMinimumSize(new Dimension(300,400)); */    japplet.add(rpanel, BorderLayout.CENTER);    /* Get the memorys (we ignore the rest) */    String mems[] = ams.get_memory_list();    int i, cnt = 1;    if (mems == null) {      getserver();      return;    }     /* count total number of object ids */    for (i=0; i<mems.length; i++) {      mem = ams.get_memory(mems[i]);      memories.put(mems[i],mem);     /* keep memories in hash table so do not have to access remote system for memories */      String flist[] = mem.get_field_list();      if (!flist[0].equals("Class")) continue; /* Not a published PETSc object */      int id = mem.get_field("Id").getIntData()[0];      cnt = id > cnt ? id : cnt;    }    DefaultMutableTreeNode root = new DefaultMutableTreeNode(),nodes[] = new DefaultMutableTreeNode[cnt+1];    /* create treenode for each published object */    for (i=0; i<mems.length; i++) {      mem = (AMS_Memory) memories.get(mems[i]);      String flist[] = mem.get_field_list();      if (!flist[0].equals("Class")) continue; /* Not a published PETSc object */      int id = mem.get_field("Id").getIntData()[0];      nodes[id] = new DefaultMutableTreeNode(mems[i]);    }    /* mark parents of each tree node */    for (i=0; i<mems.length; i++) {      mem = (AMS_Memory) memories.get(mems[i]);      String flist[] = mem.get_field_list();      if (!flist[0].equals("Class")) continue; /* Not a published PETSc object */      int parent = mem.get_field("ParentId").getIntData()[0];      int id = mem.get_field("Id").getIntData()[0];         System.out.println("me "+id+" parant "+parent);          if (parent > 0 && nodes[parent] != null) {        nodes[parent].add(nodes[id]);        nodes[id].setParent(nodes[parent]);      } else {        root.add(nodes[id]);        nodes[id].setParent(root);      }      int j;      for (j=0; j<flist.length; j++) {         System.out.println("mem "+mems[i]+" field "+flist[j]);          }    }        DefaultTreeModel tree = new DefaultTreeModel(root);    JTree jtree = new JTree(tree);    jtree.addTreeSelectionListener(new TreeSelectionListener() {      public void valueChanged(TreeSelectionEvent e) {        System.out.println("User selected tree node"); 	System.out.println("node "+e.getPath().getLastPathComponent());        Object obj = ((DefaultMutableTreeNode)(e.getPath().getLastPathComponent())).getUserObject();	AMS_Memory thisksp = (AMS_Memory) memories.get((String)obj);	System.out.println("thisksp "+thisksp);        JInternalFrame jp = new PETScViewKSP(thisksp);        rpanel.add(jp);	/*        jp.setLocation(50,50); */      }    });    japplet.add(new JScrollPane(jtree), BorderLayout.WEST);     jtree.setCellRenderer(new MyTreeCellRenderer());    jtree.setRowHeight(15);    jtree.setPreferredSize(new Dimension(300,550));    System.out.println("Processed options set");        japplet.setVisible(true);    japplet.validate();     japplet.repaint();     System.out.println("Repainted");     }