The Javatm Telnet Application/Applet: Terminal Plugin

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

Version 2.0 beta / 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 and vt320/vt220/vt100 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.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. (not yet implemented)
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".
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.
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.

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:
 

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 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 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 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.
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.

Copyright 1996-1999 Matthias L. Jugel, Marcus Meißner
$Id: Terminal.html,v 1.2 1999/09/23 13:43:50 leo Exp $