japplet.setVisible(false);
  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 options");        JButton done = new JButton("Done");    japplet.add(done);    done.addActionListener(new ActionListener() {      public void actionPerformed(ActionEvent e) {        japplet.removeAll();        System.out.println("User selected done");        getserver();      }    });    japplet.setVisible(true);    japplet.validate();     japplet.repaint();             String options = "Options_"+count++;    /* Get the options memory (we ignore the rest) */    mem = ams.get_memory(options);    checking = true;    while (mem == null) {      try {Thread.sleep(300);} catch (InterruptedException ex) {;} finally {;}       if (!checking) return;      mem = ams.get_memory(options);    }    System.out.println("Got next set of options");        japplet.removeAll();    japplet.setVisible(false);    japplet.setLayout(new FlowLayout());            tpanel = new JPanel(new GridLayout(1,1));    japplet.add(tpanel, BorderLayout.NORTH);    /* Create text area where choices will be displayed */    panel = new JPanel(new GridLayout(0,2));            /* Put the text area in a scroller. */    JScrollPane scroll = new JScrollPane();    scroll.getViewport().add(panel);    japplet.add(scroll,BorderLayout.CENTER);    /* Create a Panel that  will contain two buttons. Default layout manager */    JPanel bpanel = new JPanel(new GridLayout(1,2));            /* Add two buttons */    JButton button = new JButton("Continue");    bpanel.add(button);    button.addActionListener(new ContinueActionListener()); /* callback for button */            button = new JButton("Quit");    bpanel.add(button);    button.addActionListener(new QuitActionListener());            /* Add the Panel in the bottom of the Frame */    japplet.add(bpanel, BorderLayout.SOUTH);    /* first field is always the name of the options being set */    String flist[] = mem.get_field_list();    String OptionsCategory = flist[0];    String Prefix = mem.get_field(flist[0]).getStringData()[0];    System.out.println("prefix"+Prefix);        if (Prefix != null) {      OptionsCategory = Prefix+":"+OptionsCategory;    }    JLabel  label = new JLabel(OptionsCategory);    /*label.setAlignment(JLabel.CENTER); */    label.setForeground(Color.red);    tpanel.add(label);    /* second field is mansec */    String mansec = flist[1];    System.out.println("mansec"+mansec);        boolean left = false;    /* Loop over the rest of the fields */    int i;    for (i=3; i<flist.length; i++) {      AMS_Field lockfld    = mem.get_field(flist[i]);      String    man        = mem.get_field(flist[i+1]).getStringData()[0];      AMS_Field fld        = mem.get_field(flist[i+2]);      int       info[]     = fld.get_field_info();      String    tag        = flist[i+2];      String    tip        = flist[i];      left = !left;      /* handle OptionsSelectInt() */      if (info[1] == AMSBean.INT) {        int value[] = fld.getIntData();        panel.add(new JPanelPack(new TextFieldInt(flist[i],flist[i+2],value[0]),tag,tip,man,mansec));      } else if (info[1] == AMSBean.BOOLEAN) {        /* is it a header label? If so, print it centered accross the screen */        if (flist[i].substring(0,8).equals("-amshead")) {          if (!left) {            panel.add(new JLabel(" "));          }          int len = flist[i+2].length();          label = new JLabel(flist[i+2].substring(0,1+len/2));          label.setHorizontalAlignment(SwingConstants.RIGHT);           label.setForeground(Color.red);          panel.add(label);          label = new JLabel(flist[i+2].substring(1+len/2));          label.setHorizontalAlignment(SwingConstants.LEFT);           label.setForeground(Color.red);          panel.add(label);        } else {          boolean value[] = fld.getBooleanData();          MyCheckbox checkbox;          checkbox = new MyCheckbox(flist[i],flist[i+2],value[0]);          checkbox.addItemListener(new MyCheckboxItemListener());          panel.add(new JPanelPack(checkbox,tag,tip,man,mansec));        }      /* handle OptionsSelectDouble() */      } else if (info[1] == AMSBean.DOUBLE) {        double value[] = fld.getDoubleData();        panel.add(new JPanelPack(new TextFieldDouble(flist[i],flist[i+2],value[0]),tag,tip,man,mansec));      /* handle string */      } else if (info[1] == AMSBean.STRING) {        String value[] = fld.getStringData();               /* handle OptionsSelectList() */        if ((flist[i+2].substring(0,8)).equals("DEFAULT:")) {          int       j;          AMS_Field lfld    = mem.get_field(flist[i+3]);          String    llist[] = lfld.getStringData();          MyChoice  choice = new MyChoice(flist[i],flist[i+2]);    System.out.println("flist[i]"+flist[i]+"flist[i+1]"+flist[i+1]+"flist[i+3]"+flist[i+3]);              choice.addItem(value[0]);          for (j=0; j<llist.length-1; j++) {            if (!llist[j].equals(value[0])) {              choice.addItem(llist[j]);            }          }          choice.addItemListener(new MyChoiceItemListener());          tag = flist[i+2].substring(8);          panel.add(new JPanelPack(choice,tag,tip,man,mansec));          i++;        /* handle OptionsSelectString() */        } else {          panel.add(new JPanelPack(new TextFieldString(flist[i],flist[i+2],value[0]),tag,tip,man,mansec));        }      }      i++; i++;    }    System.out.println("Processed options set");        japplet.setVisible(true);    japplet.validate();     japplet.repaint();  }