Some source corrections

  • Nobody/Anonymous

    I solved three annoying problems that I experienced when trying to get this to work on a Windows machine locally:

    1) Windows Telnet server does not react to RETURN key

    2) crash on NumberFormatException if no port is in the .conf file (should be defaulted to 23)

    3) problem with missing menu item

    Problem 1)

    In add a piece of code similar to the localecho property to add CRLF as a property in the .conf file.

    a) declarations: add one boolean
    private boolean localecho_overridden = false;
      private boolean CRLF_overridden = false;

    b) in the constructor: add piece of code after following one
        if ((tmp = cfg.getProperty("Terminal", id, "localecho")) != null) {
          localecho_overridden = true;

        if ((tmp = cfg.getProperty("Terminal", id, "CRLF")) != null) {
          CRLF_overridden = true;

    In, make sure CRLF is sent if the property is set

    a) add routine to set the property

       /** we should send CR/LF always for Microsoft telnet */
      private boolean sendCRLF = false;

       * Enable or disable the CRLF property of the server.
       * @param sendCRLF true if the terminal should send CRLF on pressing RETURN key
      public void setSendCRLF(boolean crlf) {
        this.sendCRLF = crlf;

    b) add code to the keyTyped() routine to check the new property:

        if (((keyCode == KeyEvent.VK_ENTER) || (keyChar == 10))
                && !control) {
          // for MICROSOFT WINDOWS it is necessary to send a
    sequence, otherwise Microsoft Telnet does  not answer
          // for other Telnets,
    should probably do.
          if (sendCRLF)       write("\r\n", false);
          else  write("\n", false);
          if (localecho) putString("\r\n"); // bad hack

    Added a new source file in
    package de.mud.jta.event;
    import de.mud.jta.PluginListener;
    public interface CRLFListener extends PluginListener {
      /** Called if the local echo property changes. */
      public void setCRLF(boolean crlf);

    Problem 2)

    In, find following lines and then insert the test

                  getAppletContext().showStatus("Trying " + host + " " + port + " ...");
              if (port == null || port.length() <= 0) {
                port = "23";
                System.err.println("defaulted port to 23");
                  pluginLoader.broadcast(new SocketRequest(host,                      Integer.parseInt(port)));

    Problem 3)

    In,  find following lines, then add the code to test on existence of the menu item

            Map menuList = pluginLoader.getMenus();
            names = menuList.keySet().iterator();
            while (names.hasNext()) {
              String name = (String);
              Object o = menuList.get(name);
              if (o instanceof Menu) mb.add((Menu) o);

    • Marcus Meissner

      Marcus Meissner - 2003-12-09

      actually you can fix (1) easier by
      replacing write("
      ",false); by write("

      this should fix the windows nt return key problem

    • Nobody/Anonymous

      Hi, when i run jta26.jar as applet the 'Capture' and 'Terminal' menu is missing. But if run the jta26.jar as standalone program it works well. Anybody can help?


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks