|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.text.JTextComponent
javax.swing.JEditorPane
javax.swing.JTextPane
edu.neu.ccs.console.ConsoleTextPane
A text pane for styled input and output of console text.
This class is used internally by the JPT and should not need to be used outside of the JPT console package.
There was a change between Java 1.4 and Java 5.0 that broke the key handler code in processComponentKeyEvent. After much effort, this method and related code has been rewritten so that it works with both Java 1.4 and Java 5.0 libraries.
In 2.7.0, made the font in the console bold by default for better readability.
ConsoleWindow,
ConsoleGateway,
ConsoleInputListener| Nested Class Summary |
| Nested classes inherited from class javax.swing.JEditorPane |
JEditorPane.AccessibleJEditorPane, JEditorPane.AccessibleJEditorPaneHTML, JEditorPane.JEditorPaneAccessibleHypertextSupport |
| Nested classes inherited from class javax.swing.text.JTextComponent |
JTextComponent.AccessibleJTextComponent, JTextComponent.KeyBinding |
| Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
| Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
| Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
| Field Summary | |
private Style |
base
Base style from which all other styles are created. |
private Color[] |
color
Rendering colors used for the three streams plus the transparent renderer. |
private StyleContext |
context
Style context for styles used in the text pane. |
private int |
currentstream
The current stream. |
private DefaultStyledDocument |
doc
Styled document used as the data model for the text pane. |
private String |
endl
Platform dependent line separator sequence. |
static int |
ERR
Constant index for the error stream. |
private int |
fontSize
The current font size as set by the setFontSize method. |
static int |
IN
Constant index for the input stream. |
protected static int |
maxFontSize
The maximum console font size. |
protected static int |
minFontSize
The minimum console font size. |
static int |
OUT
Constant index for the output stream. |
private int |
start
Caret position indicating the beginning of the current input text. |
private ConsoleWindow |
window
Console window containing this text pane. |
| Fields inherited from class javax.swing.JTextPane |
|
| Fields inherited from class javax.swing.JEditorPane |
|
| Fields inherited from class javax.swing.text.JTextComponent |
DEFAULT_KEYMAP, FOCUS_ACCELERATOR_KEY |
| Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
| Fields inherited from class java.awt.Container |
|
| Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
| Fields inherited from interface edu.neu.ccs.util.JPTConstants |
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE |
| Fields inherited from interface javax.swing.SwingConstants |
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST |
| Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
| Constructor Summary | |
private |
ConsoleTextPane()
Constructs a console text pane ready for modification through the deserialization process. |
|
ConsoleTextPane(ConsoleWindow w)
Constructs a console text pane contained by the given console window. |
| Method Summary | |
void |
append(String text,
int stream)
Appends the given text produced by the given output stream to the end of the text pane content. |
private void |
beep()
Sounds the default system beep. |
void |
cut()
Cuts the currently selected text out of the pane and stores it on the system clipboard, but only if the selected text is completely enclosed within the bounds of the current input text. |
private void |
fireConsoleInputPerformed(String text)
Notifies registered listeners that an input String
was gathered by console input. |
Color |
getErrorColor()
Returns the current error color for this pane. |
String |
getFontFamilyName()
Returns the font family name of the console font. |
int |
getFontSize()
Returns the actual font size last set by the method setFontSize after any adjustments. |
Color |
getInputColor()
Returns the current input color for this pane. |
static int |
getMaximumFontSize()
Get the maximum font size that may be set for the console window. |
static int |
getMinimumFontSize()
Get the minimum font size that may be set for the console window. |
Color |
getOutputColor()
Returns the current output color for this pane. |
private Style |
getStyleFor(int stream)
Returns the appropriate rendering style for the given stream. |
void |
paste()
Pastes the clipboard contents into the pane at the current caret position, but only if the caret position or selection is completely enclosed within the bounds of the current input text. |
void |
processComponentKeyEvent(KeyEvent evt)
Handles a key event trapped by the text pane. |
void |
replaceSelection(String text)
Replaces the currently selected text with the given text, but only if the selected text is completely enclosed within the bounds of the current input text. |
void |
setErrorColor(Color c)
Sets the current error color for this pane to the given color. |
void |
setFontSize(int size)
Sets the font size for the entire pane to the given point size modulo adjustments. |
void |
setInputColor(Color c)
Sets the current input color for this pane to the given color. |
void |
setOutputColor(Color c)
Sets the current output color for this pane to the given color. |
void |
setStream(int stream)
Sets the currently active stream for the console. |
| Methods inherited from class javax.swing.JTextPane |
addStyle, createDefaultEditorKit, getCharacterAttributes, getInputAttributes, getLogicalStyle, getParagraphAttributes, getStyle, getStyledDocument, getStyledEditorKit, getUIClassID, insertComponent, insertIcon, paramString, removeStyle, setCharacterAttributes, setDocument, setEditorKit, setLogicalStyle, setParagraphAttributes, setStyledDocument |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int OUT
public static final int ERR
public static final int IN
private transient String endl
private int start
private StyleContext context
private DefaultStyledDocument doc
private Style base
private Color[] color
private ConsoleWindow window
private int currentstream
protected static final int minFontSize
protected static final int maxFontSize
private int fontSize
| Constructor Detail |
private ConsoleTextPane()
public ConsoleTextPane(ConsoleWindow w)
w - the console window to contain the new pane| Method Detail |
public void processComponentKeyEvent(KeyEvent evt)
evt - the trapped key event
public void append(String text,
int stream)
text - the text to append to the panestream - the identifier of the stream
that produced the textreplaceSelection(String)public void replaceSelection(String text)
text - the text with which to replace the selected textappend(String, int)public void cut()
paste()public void paste()
cut()public final String getFontFamilyName()
public final int getFontSize()
Returns the actual font size last set by the method
setFontSize after any adjustments.
public static final int getMinimumFontSize()
public static final int getMaximumFontSize()
public final void setFontSize(int size)
Sets the font size for the entire pane to the given point size modulo adjustments. The font size is forced between a minimum of 10 and a maximum of 72.
size - the desired font sizepublic void setStream(int stream)
stream - the active stream for the console which must
equal OUT, ERR, or INpublic void setInputColor(Color c)
null.
c - the desired input colorgetInputColor()public Color getInputColor()
setInputColor(Color)public void setOutputColor(Color c)
null.
c - the desired output colorgetOutputColor()public Color getOutputColor()
setOutputColor(Color)public void setErrorColor(Color c)
null.
c - the desired error colorgetErrorColor()public Color getErrorColor()
setErrorColor(Color)private void fireConsoleInputPerformed(String text)
String
was gathered by console input.
text - the gathered input StringConsoleInputListenerprivate Style getStyleFor(int stream)
stream - the stream to be renderedprivate void beep()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||