private synchronized void closeAll() {
    try {
      // Close all child window
      WindowManager.closeAll();

      // Remove all child component
      pnlThread.setVisible(false);
      pnlUser.setVisible(false);
      pnlThread.removeAll();
      clearAll(txtBoard);
      tblUser.setData(new Vector());
      Thread.sleep(500);
    } catch (Exception e) {
      e.printStackTrace();
      MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
    }
  }
 private void jbInit() throws Exception {
   ////////////////////////////////////////////////////////
   // Init LAF
   ////////////////////////////////////////////////////////
   ButtonGroup grpLAF = new ButtonGroup();
   ActionListener lsnLAF =
       new ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           int iIndex = mvtLAFItem.indexOf(evt.getSource());
           if (iIndex >= 0) changeLAF(iIndex);
         }
       };
   ////////////////////////////////////////////////////////
   UIManager.LookAndFeelInfo laf =
       new UIManager.LookAndFeelInfo(
           "Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel");
   marrLaf = UIManager.getInstalledLookAndFeels();
   int iIndex = 0;
   while (iIndex < marrLaf.length && !marrLaf[iIndex].getName().equals(laf.getName())) iIndex++;
   if (iIndex >= marrLaf.length) {
     UIManager.installLookAndFeel(laf);
     marrLaf = UIManager.getInstalledLookAndFeels();
   }
   for (iIndex = 0; iIndex < marrLaf.length; iIndex++) {
     JMenuItem mnu = new JRadioButtonMenuItem(marrLaf[iIndex].getName());
     mnu.addActionListener(lsnLAF);
     mvtLAFItem.addElement(mnu);
     mnuUI.add(mnu);
     grpLAF.add(mnu);
   }
   mnuUI.addSeparator();
   ////////////////////////////////////////////////////////
   // Init language
   ////////////////////////////////////////////////////////
   ButtonGroup grpLanguage = new ButtonGroup();
   ActionListener lsnLanguage =
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           int iIndex = mvtLanguageItem.indexOf(e.getSource());
           if (iIndex >= 0) changeDictionary((String) mvtLanguage.elementAt(iIndex));
         }
       };
   ////////////////////////////////////////////////////////
   String[] str = MonitorDictionary.getSupportedLanguage();
   for (iIndex = 0; iIndex < str.length; iIndex++) {
     JMenuItem mnu =
         new JRadioButtonMenuItem(MonitorDictionary.getDictionary(str[iIndex]).getLanguage());
     mnu.addActionListener(lsnLanguage);
     mvtLanguage.addElement(str[iIndex]);
     mvtLanguageItem.addElement(mnu);
     mnuUI.add(mnu);
     grpLanguage.add(mnu);
   }
   ////////////////////////////////////////////////////////
   // Add to main menu
   ////////////////////////////////////////////////////////
   mnuMain.removeAll();
   mnuMain.add(mnuSystem);
   mnuSystem.add(mnuSystem_Login);
   mnuSystem.add(mnuSystem_ChangePassword);
   mnuSystem.addSeparator();
   mnuSystem.add(mnuSystem_StopServer);
   mnuSystem.add(mnuSystem_EnableThreads);
   mnuMain.add(mnuUI);
   mnuMain.add(mnuHelp);
   mnuHelp.add(mnuHelp_About);
   ////////////////////////////////////////////////////////
   mnuMain.add(chkVietnamese);
   mnuMain.add(lblStatus);
   ////////////////////////////////////////////////////////
   pnlThread.setTabPlacement(JTabbedPane.LEFT);
   pnlThread.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
   ////////////////////////////////////////////////////////
   tblUser.addColumn("", 1, false);
   tblUser.addColumn("", 2, false, Global.FORMAT_DATE_TIME);
   tblUser.addColumn("", 3, false);
   ////////////////////////////////////////////////////////
   JPanel pnlMessage = new JPanel();
   pnlMessage.setLayout(new GridBagLayout());
   pnlMessage.add(
       new JScrollPane(txtBoard),
       new GridBagConstraints(
           0,
           0,
           2,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlMessage.add(
       txtMessage,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           1.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlMessage.add(
       btnSend,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(2, 2, 2, 2),
           0,
           0));
   txtBoard.setEditable(false);
   txtBoard.setAutoscrolls(true);
   txtBoard.setContentType("text/html");
   clearAll(txtBoard);
   ////////////////////////////////////////////////////////
   JPanel pnlUserButton = new JPanel(new GridLayout(1, 2, 4, 4));
   pnlUserButton.add(btnKick);
   pnlUserButton.add(btnRefresh);
   ////////////////////////////////////////////////////////
   JPanel pnlManager = new JPanel(new GridBagLayout());
   pnlManager.add(
       new JScrollPane(tblUser),
       new GridBagConstraints(
           0,
           0,
           1,
           1,
           1.0,
           1.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.BOTH,
           new Insets(2, 2, 2, 2),
           0,
           0));
   pnlManager.add(
       pnlUserButton,
       new GridBagConstraints(
           0,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(4, 2, 4, 2),
           0,
           0));
   ////////////////////////////////////////////////////////
   pnlUser.setDividerLocation(320);
   pnlUser.setLeftComponent(pnlManager);
   pnlUser.setRightComponent(pnlMessage);
   pnlUser.setOneTouchExpandable(true);
   ////////////////////////////////////////////////////////
   setOrientation(JSplitPane.VERTICAL_SPLIT);
   setOneTouchExpandable(true);
   pnlThread.setVisible(false);
   pnlUser.setVisible(false);
   setTopComponent(pnlThread);
   setBottomComponent(pnlUser);
   ////////////////////////////////////////////////////////
   pmn.add(mnuSelectAll);
   pmn.addSeparator();
   pmn.add(mnuClearSelected);
   pmn.add(mnuClearAll);
   ////////////////////////////////////////////////////////
   setBorder(BorderFactory.createEmptyBorder());
   pnlUser.setBorder(BorderFactory.createEmptyBorder());
   pnlManager.setBorder(
       BorderFactory.createBevelBorder(
           javax.swing.border.BevelBorder.RAISED,
           Color.white,
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background")));
   pnlMessage.setBorder(
       BorderFactory.createBevelBorder(
           javax.swing.border.BevelBorder.RAISED,
           Color.white,
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background"),
           UIManager.getColor("Panel.background")));
   ////////////////////////////////////////////////////////
   Skin.applySkin(mnuMain);
   Skin.applySkin(tblUser);
   Skin.applySkin(pmn);
   Skin.applySkin(this);
   ////////////////////////////////////////////////////////
   // Default setting
   ////////////////////////////////////////////////////////
   Hashtable prt = null;
   try {
     prt = Global.loadHashtable(Global.FILE_CONFIG);
   } catch (Exception e) {
     prt = new Hashtable();
   }
   changeLAF(Integer.parseInt(StringUtil.nvl(prt.get("LAF"), "0")));
   changeDictionary(StringUtil.nvl(prt.get("Language"), "VN"));
   Skin.LANGUAGE_CHANGE_LISTENER = this;
   MonitorProcessor.setRootObject(this);
   updateKeyboardUI();
   ////////////////////////////////////////////////////////
   // Event handler
   ////////////////////////////////////////////////////////
   tblUser.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getClickCount() > 1) btnKick.doClick();
         }
       });
   ////////////////////////////////////////////////////////
   btnRefresh.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           try {
             DDTP request = new DDTP();
             request.setRequestID(String.valueOf(System.currentTimeMillis()));
             DDTP response = channel.sendRequest("ThreadProcessor", "queryUserList", request);
             if (response != null) {
               tblUser.setData((Vector) response.getReturn());
               if (mstrChannel != null) removeUser(mstrChannel);
             }
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   btnKick.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           int iSelected = tblUser.getSelectedRow();
           if (iSelected < 0) return;
           int iResult =
               MessageBox.showConfirmDialog(
                   pnlThread,
                   mdic.getString("ConfirmKick"),
                   Global.APP_NAME,
                   MessageBox.YES_NO_OPTION);
           if (iResult == MessageBox.NO_OPTION) return;
           try {
             String strChannel = (String) tblUser.getRow(iSelected).elementAt(0);
             DDTP request = new DDTP();
             request.setRequestID(String.valueOf(System.currentTimeMillis()));
             request.setString("strChannel", strChannel);
             DDTP response = channel.sendRequest("ThreadProcessor", "kickUser", request);
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   txtMessage.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           btnSend.doClick();
         }
       });
   ////////////////////////////////////////////////////////
   btnSend.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent evt) {
           if (txtMessage.getText().length() == 0) return;
           try {
             DDTP request = new DDTP();
             request.setString("strMessage", txtMessage.getText());
             channel.sendRequest("ThreadProcessor", "sendMessage", request);
             txtMessage.setText("");
           } catch (Exception e) {
             e.printStackTrace();
             MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);
           }
         }
       });
   ////////////////////////////////////////////////////////
   mnuClearAll.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           clearAll(txtBoard);
         }
       });
   ////////////////////////////////////////////////////////
   mnuClearSelected.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           txtBoard.setEditable(true);
           txtBoard.replaceSelection("");
           txtBoard.setEditable(false);
         }
       });
   ////////////////////////////////////////////////////////
   mnuSelectAll.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           txtBoard.requestFocus();
           txtBoard.selectAll();
         }
       });
   ////////////////////////////////////////////////////////
   txtBoard.addMouseListener(
       new MouseAdapter() {
         public void mouseClicked(MouseEvent e) {
           if (e.getButton() == e.BUTTON3) pmn.show(txtBoard, e.getX(), e.getY());
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_Login.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           login();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_ChangePassword.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           changePassword();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_StopServer.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           stopServer();
         }
       });
   ////////////////////////////////////////////////////////
   mnuSystem_EnableThreads.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           manageThreads();
         }
       });
   ////////////////////////////////////////////////////////
   mnuHelp_About.addActionListener(
       new ActionListener() {
         public void actionPerformed(ActionEvent e) {
           WindowManager.centeredWindow(new DialogAbout(PanelThreadManager.this));
         }
       });
   ////////////////////////////////////////////////////////
   chkVietnamese.addActionListener(
       new java.awt.event.ActionListener() {
         public void actionPerformed(ActionEvent e) {
           switchKeyboard();
         }
       });
 }
  // Here some legacy code makes use of generics. They are tested, so there
  // is no risk of an actual error, but Java issues a warning.
  @SuppressWarnings("unchecked")
  public DialogParameters(
      JFrame parent, Vector<ParameterDescription> vec, boolean strict, Vector<LayerDesc> layers) {
    super(parent, Globals.messages.getString("Param_opt"), true);

    keyb1 = new OSKeybPanel(KEYBMODES.GREEK);
    keyb2 = new OSKeybPanel(KEYBMODES.MISC);
    keyb1.setField(this);
    keyb2.setField(this);
    keyb.addTab("Greek", keyb1);
    keyb.addTab("Misc", keyb2);
    keyb.setVisible(false);
    v = vec;

    int ycount = 0;

    // We create dynamically all the needed elements.
    // For this reason, we work on arrays of the potentially useful Swing
    // objects.

    jtf = new JTextField[MAX_ELEMENTS];
    jcb = new JCheckBox[MAX_ELEMENTS];
    jco = new JComboBox[MAX_ELEMENTS];

    active = false;
    addComponentListener(this);

    GridBagLayout bgl = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    Container contentPane = getContentPane();
    contentPane.setLayout(bgl);
    boolean extStrict = strict;

    ParameterDescription pd;

    int top = 0;

    JLabel lab;

    tc = 0;
    cc = 0;
    co = 0;

    // We process all parameter passed. Depending on its type, a
    // corresponding interface element will be created.
    // A symmetrical operation is done when validating parameters.

    for (ycount = 0; ycount < v.size(); ++ycount) {
      if (ycount > MAX) break;

      pd = (ParameterDescription) v.elementAt(ycount);

      // We do not need to store label objects, since we do not need
      // to retrieve data from them.

      lab = new JLabel(pd.description);
      constraints.weightx = 100;
      constraints.weighty = 100;
      constraints.gridx = 1;
      constraints.gridy = ycount;
      constraints.gridwidth = 1;
      constraints.gridheight = 1;

      // The first element needs a little bit more space at the top.
      if (ycount == 0) top = 10;
      else top = 0;

      // Here we configure the grid layout

      constraints.insets = new Insets(top, 20, 0, 6);

      constraints.fill = GridBagConstraints.VERTICAL;
      constraints.anchor = GridBagConstraints.EAST;
      lab.setEnabled(!(pd.isExtension && extStrict));

      if (!(pd.parameter instanceof Boolean)) contentPane.add(lab, constraints);

      constraints.anchor = GridBagConstraints.WEST;
      constraints.insets = new Insets(top, 0, 0, 0);
      constraints.fill = GridBagConstraints.HORIZONTAL;

      // Now, depending on the type of parameter we create interface
      // elements and we populate the dialog.

      if (pd.parameter instanceof PointG) {
        jtf[tc] = new JTextField(10);
        jtf[tc].setText("" + ((PointG) (pd.parameter)).x);
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        // Disable FidoCadJ extensions in the strict compatibility mode
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));

        contentPane.add(jtf[tc++], constraints);

        jtf[tc] = new JTextField(10);
        jtf[tc].setText("" + ((PointG) (pd.parameter)).y);
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 3;
        constraints.gridy = ycount;
        constraints.gridwidth = 1;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 6, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jtf[tc++], constraints);
      } else if (pd.parameter instanceof String) {
        jtf[tc] = new JTextField(24);
        jtf[tc].setText((String) (pd.parameter));
        // If we have a String text field in the first position, its
        // contents should be evidenced, since it is supposed to be
        // the most important field (e.g. for the AdvText primitive)
        if (ycount == 0) jtf[tc].selectAll();
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));

        contentPane.add(jtf[tc++], constraints);

      } else if (pd.parameter instanceof Boolean) {
        jcb[cc] = new JCheckBox(pd.description);
        jcb[cc].setSelected(((Boolean) (pd.parameter)).booleanValue());
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jcb[cc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jcb[cc++], constraints);
      } else if (pd.parameter instanceof Integer) {
        jtf[tc] = new JTextField(24);
        jtf[tc].setText(((Integer) pd.parameter).toString());
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jtf[tc++], constraints);
      } else if (pd.parameter instanceof Float) {
        // TODO.
        // WARNING: (DB) this is supposed to be temporary. In fact, I
        // am planning to upgrade some of the parameters from int
        // to float. But for a few months, the users should not be
        // aware of that, even if the internal representation is
        // slowing being adapted.
        jtf[tc] = new JTextField(24);
        int dummy = java.lang.Math.round((Float) pd.parameter);
        jtf[tc].setText("" + dummy);
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jtf[tc].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jtf[tc++], constraints);
      } else if (pd.parameter instanceof FontG) {
        GraphicsEnvironment gE;
        gE = GraphicsEnvironment.getLocalGraphicsEnvironment();
        String[] s = gE.getAvailableFontFamilyNames();
        jco[co] = new JComboBox();

        for (int i = 0; i < s.length; ++i) {
          jco[co].addItem(s[i]);
          if (s[i].equals(((FontG) pd.parameter).getFamily())) jco[co].setSelectedIndex(i);
        }
        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);
      } else if (pd.parameter instanceof LayerInfo) {
        jco[co] = new JComboBox(new Vector<LayerDesc>(layers));
        jco[co].setSelectedIndex(((LayerInfo) pd.parameter).layer);
        jco[co].setRenderer(new LayerCellRenderer());

        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);

      } else if (pd.parameter instanceof ArrowInfo) {
        jco[co] = new JComboBox<ArrowInfo>();
        jco[co].addItem(new ArrowInfo(0));
        jco[co].addItem(new ArrowInfo(1));
        jco[co].addItem(new ArrowInfo(2));
        jco[co].addItem(new ArrowInfo(3));

        jco[co].setSelectedIndex(((ArrowInfo) pd.parameter).style);
        jco[co].setRenderer(new ArrowCellRenderer());

        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);

      } else if (pd.parameter instanceof DashInfo) {

        jco[co] = new JComboBox<DashInfo>();

        for (int k = 0; k < Globals.dashNumber; ++k) {
          jco[co].addItem(new DashInfo(k));
        }

        jco[co].setSelectedIndex(((DashInfo) pd.parameter).style);
        jco[co].setRenderer(new DashCellRenderer());

        constraints.weightx = 100;
        constraints.weighty = 100;
        constraints.gridx = 2;
        constraints.gridy = ycount;
        constraints.gridwidth = 2;
        constraints.gridheight = 1;
        constraints.insets = new Insets(top, 0, 0, 20);
        constraints.fill = GridBagConstraints.HORIZONTAL;
        jco[co].setEnabled(!(pd.isExtension && extStrict));
        contentPane.add(jco[co++], constraints);
      }
    }
    // Put the OK and Cancel buttons and make them active.
    JButton ok = new JButton(Globals.messages.getString("Ok_btn"));
    JButton cancel = new JButton(Globals.messages.getString("Cancel_btn"));
    JButton keybd = new JButton("\u00B6\u2211\u221A"); // phylum
    keybd.setFocusable(false);
    keybd.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            // If at this point, the keyboard is not visible, this means
            // that it will become visible in a while. It is better to
            // resize first and then show up the keyboard.
            if (keyb.isVisible()) {
              MIN_WIDTH = 400;
              MIN_HEIGHT = 350;
            } else {
              MIN_WIDTH = 400;
              MIN_HEIGHT = 500;
            }
            // setSize(MIN_WIDTH, MIN_HEIGHT);
            keyb.setVisible(!keyb.isVisible());
            pack();
          }
        });

    constraints.gridx = 0;
    constraints.gridy = ycount++;
    constraints.gridwidth = 4;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.EAST;
    constraints.insets = new Insets(6, 20, 20, 20);

    // Put the OK and Cancel buttons and make them active.
    Box b = Box.createHorizontalBox();
    b.add(keybd); // phylum

    b.add(Box.createHorizontalGlue());
    ok.setPreferredSize(cancel.getPreferredSize());

    if (Globals.okCancelWinOrder) {
      b.add(ok);
      b.add(Box.createHorizontalStrut(12));
      b.add(cancel);

    } else {
      b.add(cancel);
      b.add(Box.createHorizontalStrut(12));
      b.add(ok);
    }
    // b.add(Box.createHorizontalStrut(12));
    contentPane.add(b, constraints);

    constraints.gridx = 0;
    constraints.gridy = ycount;
    constraints.gridwidth = 4;
    constraints.gridheight = 1;
    constraints.anchor = GridBagConstraints.EAST;
    constraints.insets = new Insets(6, 20, 20, 20);

    contentPane.add(keyb, constraints);

    ok.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            try {
              int ycount;
              ParameterDescription pd;
              tc = 0;
              cc = 0;
              co = 0;

              // Here we read all the contents of the interface and we
              // update the contents of the parameter description array.

              for (ycount = 0; ycount < v.size(); ++ycount) {
                if (ycount > MAX) break;
                pd = (ParameterDescription) v.elementAt(ycount);

                if (pd.parameter instanceof PointG) {
                  ((PointG) (pd.parameter)).x = Integer.parseInt(jtf[tc++].getText());
                  ((PointG) (pd.parameter)).y = Integer.parseInt(jtf[tc++].getText());
                } else if (pd.parameter instanceof String) {
                  pd.parameter = jtf[tc++].getText();
                } else if (pd.parameter instanceof Boolean) {
                  pd.parameter = Boolean.valueOf(jcb[cc++].isSelected());
                } else if (pd.parameter instanceof Integer) {
                  pd.parameter = Integer.valueOf(Integer.parseInt(jtf[tc++].getText()));
                } else if (pd.parameter instanceof Float) {
                  pd.parameter = Float.valueOf(Float.parseFloat(jtf[tc++].getText()));
                } else if (pd.parameter instanceof FontG) {
                  pd.parameter = new FontG((String) jco[co++].getSelectedItem());
                } else if (pd.parameter instanceof LayerInfo) {
                  pd.parameter = new LayerInfo(jco[co++].getSelectedIndex());
                } else if (pd.parameter instanceof ArrowInfo) {
                  pd.parameter = new ArrowInfo(jco[co++].getSelectedIndex());
                } else if (pd.parameter instanceof DashInfo) {
                  pd.parameter = new DashInfo(jco[co++].getSelectedIndex());
                }
              }
            } catch (NumberFormatException E) {
              // Error detected. Probably, the user has entered an
              // invalid string when FidoCadJ was expecting a numerical
              // input.

              JOptionPane.showMessageDialog(
                  null,
                  Globals.messages.getString("Format_invalid"),
                  "",
                  JOptionPane.INFORMATION_MESSAGE);
              return;
            }

            active = true;
            // Globals.activeWindow.setEnabled(true);
            setVisible(false);
            keyb.setVisible(false);
          }
        });
    cancel.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent evt) {
            // Globals.activeWindow.setEnabled(true);
            setVisible(false);
            keyb.setVisible(false);
          }
        });
    // Here is an action in which the dialog is closed

    AbstractAction cancelAction =
        new AbstractAction() {
          public void actionPerformed(ActionEvent e) {
            // Globals.activeWindow.setEnabled(true);
            setVisible(false);
            keyb.setVisible(false);
          }
        };
    DialogUtil.addCancelEscape(this, cancelAction);

    this.addWindowListener(
        new WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            // Globals.activeWindow.setEnabled(true);
            keyb.setVisible(false);
          }
        });

    pack();
    DialogUtil.center(this);
    getRootPane().setDefaultButton(ok);
  }
  public void login() {
    mbAutoLogIn = false;
    while (!mbAutoLogIn) {
      try {
        // Confirm logout
        if (isOpen()) {
          if (MessageBox.showConfirmDialog(
                  this,
                  MonitorDictionary.getString("Confirm.Exit"),
                  Global.APP_NAME,
                  MessageBox.YES_NO_OPTION)
              == MessageBox.NO_OPTION) return;

          // Disconnect from server
          disconnect();
        }

        // Login
        DialogLogin dlgLogin = new DialogLogin(this);
        WindowManager.centeredWindow(dlgLogin);

        if (dlgLogin.miReturn == JOptionPane.OK_OPTION) {
          // Update UI
          SwingUtilities.updateComponentTreeUI(pnlUser);
          SwingUtilities.updateComponentTreeUI(pnlThread);

          // Request to connect
          Socket sck = new Socket(dlgLogin.mstrHost, Integer.parseInt(dlgLogin.mstrPort));
          sck.setSoLinger(true, 0);

          // Start up a channel thread that reads messages from the server
          channel =
              new SocketTransmitter(sck) {
                public void close() {
                  if (msckMain != null) {
                    super.close();
                    closeAll();
                    if (mbAutoLogIn) login();
                  }
                }
              };
          channel.setUserName(dlgLogin.mstrUserName);
          channel.setPackage("com.fss.thread.");
          channel.start();

          // Request to Server
          DDTP request = new DDTP();
          request.setRequestID(String.valueOf(System.currentTimeMillis()));
          request.setString("UserName", dlgLogin.mstrUserName);
          request.setString("Password", dlgLogin.mstrPassword);

          // Response from Server
          DDTP response = channel.sendRequest("ThreadProcessor", "login", request);
          mstrThreadAppName = response.getString("strThreadAppName");
          mstrThreadAppVersion = response.getString("strThreadAppVersion");
          mstrAppName = response.getString("strAppName");
          mstrAppVersion = response.getString("strAppVersion");
          if (response != null) {
            if (response.getString("PasswordExpired") != null) {
              DialogChangePassword frm = new DialogChangePassword(this, channel);
              WindowManager.centeredWindow(frm);
              if (frm.miReturnValue != JOptionPane.OK_OPTION) throw new AppException("FSS-10003");
            }
            String strLog = StringUtil.nvl(response.getString("strLog"), "");
            showResult(txtBoard, strLog);
            Vector vtThread = response.getVector("vtThread");
            updateTabBar(vtThread);

            mstrChannel = response.getString("strChannel");
            if (mstrChannel != null) removeUser(mstrChannel);
          }
          btnRefresh.doClick();
          pnlThread.setVisible(true);
          pnlUser.setVisible(true);
          setResizeWeight(1);
          setDividerLocation((int) (getSize().getHeight() - 160));
        }
        mbAutoLogIn = true;
        updateLanguage();
      } catch (Exception e) {
        e.printStackTrace();
        MessageBox.showMessageDialog(this, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE);

        // Disconnect from server
        mstrChannel = null;
        disconnect();
      }
    }
  }
  /** Initialize the common user interface components. */
  private void initUI() {
    /* initialize fields */
    {
      pFileSeqPanels = new TreeMap<FileSeq, JFileSeqPanel>();
    }

    /* initialize the popup menus */
    {
      initBasicMenus(true, false);
      updateMenuToolTips();
    }

    /* initialize the panel components */
    {
      setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

      /* header */
      {
        pApplyToolTipText = "Replace the working area files with the selected checked-in files.";
        pUnApplyToolTipText = "There are no unsaved changes to Apply at this time.";

        JPanel panel = initHeader(true);
        add(panel);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      /* full node name */
      {
        LinkedList<Component> extra = new LinkedList<Component>();
        extra.add(Box.createRigidArea(new Dimension(4, 0)));
        {
          JButton btn = new JButton();
          pSeqLayoutButton = btn;
          btn.setName(pIsListLayout ? "ListLayoutButton" : "TabbedLayoutButton");

          Dimension size = new Dimension(19, 19);
          btn.setMinimumSize(size);
          btn.setMaximumSize(size);
          btn.setPreferredSize(size);

          btn.setActionCommand("seq-layout-changed");
          btn.addActionListener(this);

          extra.add(btn);
        }

        initNameField(this, extra);

        pNodeNameField.setFocusable(true);
        pNodeNameField.addKeyListener(this);
        pNodeNameField.addMouseListener(this);
      }

      add(Box.createRigidArea(new Dimension(0, 4)));

      {
        JTabbedPane tab = new JTabbedPane();
        pFileSeqsTab = tab;
        tab.setVisible(!pIsListLayout);
        add(tab);
      }

      {
        Box vbox = new Box(BoxLayout.Y_AXIS);
        pFileSeqsBox = vbox;

        {
          JScrollPane scroll = UIFactory.createVertScrollPane(vbox);
          pFileSeqsScroll = scroll;
          scroll.setVisible(!pIsListLayout);

          add(scroll);
        }
      }

      Dimension size = new Dimension(sSize + 22, 120);
      setMinimumSize(size);
      setPreferredSize(size);

      setFocusable(true);
      addKeyListener(this);
      addMouseListener(this);
    }

    updateNodeStatus(null, null, null);
  }