JTA - Telnet/SSH for the JAVA(tm) platform: Terminal Plugin

© 1996-2000 Matthias L. Jugel and Marcus Meißner

Version 2.0 / Java 2 and 1.1.x
Available under GNU General Public License

Homepage Applet Test Download Documentation Users / Opinions

Terminal (ANSI/vt320) Plugin

The terminal plugin is a visual software component that acts as the front end. It displays the data that is transmitted by the remote host and translates keystrokes to be sent to the remote host. It implements an ANSI, vt320/vt220/vt100 and SCOANSI compliant terminal.

Most of the features of the terminal emulation can be configured using the properties explained below. Additionally it provides a plugin menu that can be operated if a menu bar is available.

You can configure the plugin using the following properties:
 

Property Documentation
General Properties
Terminal.foreground Set the foreground color of the terminal. You can use 24 but hexadecimal values:
#ffffff is white and #000000 is black. This is just like the encoding you use in HTML.
Terminal.background Set the background color of the terminal. You can use 24 but hexadecimal values:
#ffffff is white and #000000 is black. This is just like the encoding you use in HTML.
Terminal.cursor.foreground Set the cursor foreground color. If unset this is the inverted current foreground.
Terminal.cursor.background Set the cursor background color. If unset this is the inverted current background.
Terminal.localecho While both SSH and Telnet client part detect localechostate automatically, it can be overridden using this option. This is only recommended if you really need it.
Set to true for always localecho and false for never.
 Terminal.print.color Set to true to print the terminal in full color. The default setting false will force the Terminal to print black & white only.
Terminal.colorSet Use this property to define a complete color set for the terminal. A color set contains eight colors as defined by the ANSI standard.

The colorset should be in a file that is referenced by this property as either a file name relative to the jar file or a complete URL.

The default value is /de/mud/terminal/colorSet.conf .

The file contains a line for each color:

color0 = color
color1 = color
...
color7 = color
bold = color
invert = color

color can be either a name or a number similar to the foreground and background above. The keywords bold and invert will set a color instead of the actual attribute for display. Bold text will be displayed using the color and inverted text will show up with a background color that is set.

Terminal.border Declare the size of the border that will sourround the terminal.
Terminal.borderRaised This property has no effect if Terminal.border is not set or zero. It may be set to "true" or "false".
Terminal.scrollBar Adds a scroll bar to the terminal using the direction set in the property. Possible directions are "East" and "West". Using a "none" removes the scrollbar completely.
Terminal.beep If this property points to a fully qualified URL of a sound file this will be played in case of a terminal bell signal. This works for applets only.
Note: Some browsers (Netscape 4, IE 5.5 or earlier) sometimes can only play .au files here. In IE the sound needs to be on the same server as the applet or you get a security exception.
Terminal Emulation Properties
Terminal.id Used to identify the type of the terminal. This is the string that is sent to the remote host. Default is "vt320" but you may use any string, like "vt100", "vt220" or "xterm" if it suits you.

If you change it to scoansi, it will change the linedrawing characters to match the scoansi ones.

Terminal.answerback The string the terminal sents back when it gets an 'ENQ' code. You can set it to anything you want or what your local environment requires. (The default is just a pointer to this config option.)
Terminal.buffer This sets the size of the scroll back buffer the terminal uses. The buffer is allocated dynamically until it reaches this size. You cannot set the scrollback buffer to a value smaller than the amount of lines on the screen.
Terminal.size Set the size of the terminal in terms of rows and lines. The value has to be given in the following format:
[width,height ]
Whitespaces are allowed within the brackets and just before and after the comma. The standard is "[80,24]"
Terminal.resize This property defines the method that is applied when the terminal window is resized. It may be either "font" - to resize the font to match the window size or "screen" - to change the amount of lines and columns displayed or "none" - to do nothing.
Terminal.font Tells the terminal which font to use for the display of characters. This is usually "Monospaced" as any other font name might not be available on the client host.
Terminal.fontStyle The font style to be used when looking up the font. The font style may be "plain", "bold" or "italic ". The default is "plain".
Terminal.fontSize The size of the font to be used. If you use automatic font resize this will be used as the initial font size.
Terminal.keyCodes This should be set to the URL of a property file that contains the key codes  you would like to use. The file is first tried using the resource loading mechanism, which looks in the CLASSPATH and then as a URL. Have a look at the file format for the key codes definition .
Terminal.VMS Set this property to "true" if you are connecting to a VMS system.
Terminal.IBM Set this to "true" if you would like to use PC ANSI graphics characters as used by some BBS's.
Terminal.encoding Use this property if you have real UNICODE fonts installed on your system or at least fonts that include the characters you would like to display. The default setting it ISO8859_1 but it may be used to make the terminal aware of special characters like in the japanese (i.e. SJIS) or chinese region.

Definition of Key Codes

The definition of key codes should only be done if your application uses a very different keyboard layout than the standard vt320. The definition of almost all special keys is possible and follows rules described below:
# here is the rule
[SCA] KEY=STRING
The characters enclosed in [ and ] are optional and only one of the characters 'S' (Shift), 'C' (Control) or 'A' (Alt) may appear before the KEY, which is a textual representation (F1, PGUP etc) of the key you would like to redefine.

The new STRING you define to be sent when pressing the key should come after the equal sign (= ). Hash marks (#) in the file declare a line as comment and will be ignored. Some examples explain the syntax:
 

Send the string "test" when pressing the F1 key:
F1 = test
On pressing Control + PGUP send the string "pgup pressed":
CPGUP = pgup pressed
Redefine the key Alt + F12 to send an escape character:
AF12 = \\e

 

 
 
 
 
 
 
 

As you can see the string you can define may contain special characters which may be escaped using the backslash (\). Allowed special characters follow in the table below:

(Important : for some of the escape codes you need two backslashes as these are our own definitions and not known by the Java Property mechanism)
 

Special Character Explanation
\\b Backspace, this character is usually sent by the <- key (not the cursor left key!).
\\e Escape, this character is usually sent by the Esc key.
\n
(only one backslash)
Newline, this character will move the cursor to a new line. On UNIX systems it is equivalent to carriage return + newline. Usually the Enter key send this character.
\r
(only one backslash)
Carriage Return, this key moves the cursor to the beginning of the line. In conjunction with Newline it moves the cursor to the beginning of a new line.
\t
(only one backslash)
Tabulator, the tab character is sent by the ->| key and moves the cursor to the next tab stop defined by the terminal.
\\v Vertical Tabulator, sends a vertical tabulator character.
\\a Bell, sends a terminal bell character which should make the terminal sound its bell, but the implementation is a silent one ;-)
\\number Inserts the character that is defined by this number in the ISO Latin1 character set. The number should be a decimal value.

The following table explains which key may be redefined. As explained above each of the keys may be prefixed by a character defining the redefinition that occures if it is pressed in conjunction with the shift, control or alt keys.
 

Key Representation Remarks
F1 - F20
The function key, F1, F2 ... up to F20.
PGUP
The Page Up key.
PGDOWN
The Page Down key.
END
The End key.
HOME
The Home (Pos 1) key.
INSERT
The Insert key.
REMOVE
The Remove key.
UP
The Cursor Up key.
DOWN
The Cursor Down key.
LEFT
The Cursor Left key.
RIGHT
The Cursor right key.
NUMPAD0 - NUMPAD9
The numbered Numpad keys.
ESCAPE
The ESCAPE key.
BACKSPACE
The backspace key.
TAB
The tabulator key.
Additional Programmer Documentation is available:
 
de.mud.jta.plugin.Terminal
This is the programmer documentation for the plugin. Use it as an example if you want to write your own back end plugins.
de.mud.jta.event
This plugins uses some of the events and listeners described here.
de.mud.terminal
Have a look here for the underlying terminal emulation package.

If you produced keyCode definition files you'd like to share with others send them to us and we will publish them here.
 
 
AT 386 Terminal
A key code definition file for an AT-386 Terminal. It should work with ANSI and most version of UNIX. More info is in the file.

Copyright 1996-2000 Matthias L. Jugel, Marcus Meißner
$Id: Terminal.html,v 1.9 2000/03/19 10:51:48 marcus Exp $