Class DebugBox
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.TextComponent
|
+----java.awt.TextArea
|
+----DebugBox
- public class DebugBox
- extends TextArea
The user enters RoBOTL code into an object of this class. The only
variations on the TextArea class is that DebugBox
can highlight a given line of text and it can pretty-print the code.
- Author:
- Peter Sagerson, petersag@wpi.edu
-
DebugBox()
-
-
format()
- Uses
RoBOTLTokenManager to tokenize the code in the text box,
from which it recreates the string using proper indentation and spacing.
-
makeSpaces(int)
-
-
selectLine(int)
- Selects the given line of text in the text box.
DebugBox
public DebugBox()
selectLine
synchronized boolean selectLine(int line)
- Selects the given line of text in the text box. requestFocus()
should be called after this function to ensure that the highlight
is displayed.
makeSpaces
String makeSpaces(int n)
- Returns:
- A string with n spaces.
format
public String format()
- Uses
RoBOTLTokenManager to tokenize the code in the text box,
from which it recreates the string using proper indentation and spacing.
The new string replaces the old one in the box and is returned.
Warning: this is not yet complete. "Else" and "do-while" are not always
handled correctly as of the current version. It should work for most
situations, however.
- Returns:
- The new (formatted) string.