guk.editIM
Class KeyStrokeParser

java.lang.Object
  |
  +--guk.editIM.KeyStrokeParser

public class KeyStrokeParser
extends java.lang.Object

Used to add HTML highlighting to strings that describe keystrokes. Most really interesting keystroke stuff is in AssignObject.java, not in this class!


Field Summary
(package private)  java.lang.StringBuffer buf
          Just a string buffer where the HTML is collected.
(package private)  java.lang.String fontName
          The font that will be mentioned in the HTML code.
 
Constructor Summary
KeyStrokeParser()
          The constructor does nothing, not needed to do anything.
KeyStrokeParser(java.awt.Font font)
          This constructor actually DOES something: It sets the font.
 
Method Summary
 java.lang.String highlight(java.lang.String what)
          highlight uses HTML markup to emphasize some special escapes in the input string.
 java.lang.String highlightComplete(java.lang.String what)
          highlightComplete uses HTML markup and adds HTML header / footer.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

buf

java.lang.StringBuffer buf
Just a string buffer where the HTML is collected.

fontName

java.lang.String fontName
The font that will be mentioned in the HTML code. Default value is Arial Unicode MS.
Constructor Detail

KeyStrokeParser

public KeyStrokeParser()
The constructor does nothing, not needed to do anything.

KeyStrokeParser

public KeyStrokeParser(java.awt.Font font)
This constructor actually DOES something: It sets the font.
Parameters:
font - The font that will be mentioned in the HTML code.
Method Detail

highlightComplete

public java.lang.String highlightComplete(java.lang.String what)
highlightComplete uses HTML markup and adds HTML header / footer.
Parameters:
what - A string that describes key strokes.
Returns:
A string with HTML that contains the input string and additional highlighting tags, starting with <html> and containing all headers and footers and an optional font selection. Note that JLabels only understand HTML 3.2 with font color and size, but not font name. They cannot do Unicode in HTML mode either, as of Java 1.3.1 ...

highlight

public java.lang.String highlight(java.lang.String what)
highlight uses HTML markup to emphasize some special escapes in the input string. Also escapes HTML reserved chars and Unicode (Unicode needs HTML 4.0 to render, JLabels only render ISO-8859-1 HTML 3.2) Recognized escapes: see Classes KeyStroke and KeyEvent, too. + can be any char. notice that the contents of \., \k+...+, \\u.... and .- are not parsed here: we only use some knowledge about their length.
Parameters:
what - A string that should be highlighted.
Returns:
The string with added HTML tags for highlighting, but without headers or footers like <html>...