Package com.ibm.icu.dev.demo.translit
Class TransliteratingTextComponent
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Canvas
-
- com.ibm.icu.dev.demo.impl.DumbTextComponent
-
- com.ibm.icu.dev.demo.translit.TransliteratingTextComponent
-
- All Implemented Interfaces:
java.awt.event.FocusListener
,java.awt.event.KeyListener
,java.awt.event.MouseListener
,java.awt.event.MouseMotionListener
,java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,java.util.EventListener
,javax.accessibility.Accessible
public class TransliteratingTextComponent extends DumbTextComponent
A subclass ofDumbTextComponent
that passes key events through aTransliterator
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
DEBUG
private static long
serialVersionUID
For serializationprivate Transliterator
translit
-
Constructor Summary
Constructors Constructor Description TransliteratingTextComponent()
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.String
escape(java.lang.String s)
Escape non-ASCII characters as Unicode.void
flush()
Transliterator
getTransliterator()
protected void
handleKeyTyped(java.awt.event.KeyEvent e)
DumbTextComponent
API.void
setTransliterator(Transliterator t)
Set theTransliterator
and direction to use to process incomingKeyEvent
s.protected void
transliterate(char ch, boolean flush)
-
Methods inherited from class com.ibm.icu.dev.demo.impl.DumbTextComponent
addActionListener, addTextListener, drawSelection, focusGained, focusLost, getKeyStart, getMaximumSize, getMinimumSize, getPreferredSize, getSelectionEnd, getSelectionStart, getText, hex, insertText, isEditable, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, nextLine, offset2Point, paint, paint2, point2Offset, removeActionListener, removeTextListener, replaceRange, select, select, select, select, setBounds, setEditable, setFont, setKeyStart, setText, setText2, update, validateKeyStart, visibleWidth
-
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization- See Also:
- Constant Field Values
-
DEBUG
private static boolean DEBUG
-
translit
private Transliterator translit
-
-
Method Detail
-
handleKeyTyped
protected void handleKeyTyped(java.awt.event.KeyEvent e)
DumbTextComponent
API. Framework method that is called when aKeyEvent
is received. This implementation runs the new character through the currentTransliterator
, if one is set, and inserts the transliterated text into the buffer.- Overrides:
handleKeyTyped
in classDumbTextComponent
-
flush
public void flush()
-
transliterate
protected void transliterate(char ch, boolean flush)
-
setTransliterator
public void setTransliterator(Transliterator t)
Set theTransliterator
and direction to use to process incomingKeyEvent
s.- Parameters:
t
- theTransliterator
to use
-
getTransliterator
public Transliterator getTransliterator()
-
escape
public static final java.lang.String escape(java.lang.String s)
Escape non-ASCII characters as Unicode. JUST FOR DEBUGGING OUTPUT.
-
-