public class JTerminal extends JPanel implements TerminalEventListener
The terminal is first rendered to a buffered image and then, whan a component repaint is requested this buffered image is painted on the given component's graphics context. The font face may be set via setFont(), with the font scaling policy set via setFontScalePolicy(). If font scaling is enabled, the font will scale to the available size of the component, rather than the component scaling to the size of the font.
This class concerns itself with rendering the data provided by a DefaultTerminalModel or appropriate subclass. The model communicates with the component through normal event-dispatching mechanisms.
paintComponent(Graphics),
setFont(Font),
doLayout(),
Serialized FormJPanel.AccessibleJPanelJComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
SCALE_FONT_OFF |
static int |
SCALE_FONT_SIZE |
static int |
STRETCH_FONT_VERTICALLY |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JTerminal()
Creates a new JTerminal with a DefaultTerminalModel (type 2),
DefaultKeyMap, and DefaultColorMap.
|
JTerminal(DefaultTerminalModel model)
Creates a new JTerminal with a DefaultKeyMap and DefaultColorMap.
|
JTerminal(DefaultTerminalModel model,
KeyMap km)
Creates a new JTerminal with a DefaultColorMap.
|
JTerminal(DefaultTerminalModel model,
KeyMap km,
ColorMap cm)
Creates a new JTerminal
|
| Modifier and Type | Method and Description |
|---|---|
void |
doLayout()
Invoked by our parent objects layout manager.
|
ColorMap |
getColorMap()
Gets the current ColorMap
|
int |
getFontScalePolicy()
Gets the font scaling policy in use.
|
KeyMap |
getKeyMap()
Retrieves the current KeyMap
|
DefaultTerminalModel |
getTerminalModel()
Gets the active TerminalModel for this JTerminal
|
protected void |
paintComponent(Graphics g)
Overrides the painting of our component's interior bounds.
|
protected void |
renderScreen()
Handles the drawing of the screen.
|
void |
setColorMap(ColorMap cm)
Sets the ColorMap.
|
void |
setFont(Font font)
Overrides setFont.
|
void |
setFontScalePolicy(int policy)
Sets the font scaling policy.
|
void |
setKeyMap(KeyMap km)
Sets the KeyMap
|
void |
setTextAntialiasing(boolean b)
Sets the font text antialiasing policy.
|
void |
terminalEventReceived(TerminalEvent te)
Handles incomming terminalEvents from the DefaultTerminalModel.
|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUIaddAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int SCALE_FONT_OFF
public static final int SCALE_FONT_SIZE
public static final int STRETCH_FONT_VERTICALLY
public JTerminal()
public JTerminal(DefaultTerminalModel model)
model - The TerminalModel to use for interaction.public JTerminal(DefaultTerminalModel model, KeyMap km)
model - The TerminalModel to use for interaction.km - The KeyMap to use when translating keyboard events.public JTerminal(DefaultTerminalModel model, KeyMap km, ColorMap cm)
model - The TerminalModel to use for interaction.km - The KeyMap to use when translating keyboard events.cm - The ColorMap to use for selecting colors while rendering.public DefaultTerminalModel getTerminalModel()
public void doLayout()
public void setFont(Font font)
setFont in class JComponentfont - The new Font face to use.public void setKeyMap(KeyMap km)
public KeyMap getKeyMap()
public void setColorMap(ColorMap cm)
public ColorMap getColorMap()
public int getFontScalePolicy()
public void setFontScalePolicy(int policy)
public void setTextAntialiasing(boolean b)
protected void paintComponent(Graphics g)
paintComponent in class JComponentg - Graphics object pre-inset.protected void renderScreen()
public void terminalEventReceived(TerminalEvent te)
terminalEventReceived in interface TerminalEventListenerte - The TerminalEvent to handleCopyright © 2013. All Rights Reserved.