Package com.ibm.icu.dev.demo.impl
Class DumbTextComponent
java.lang.Object
java.awt.Component
java.awt.Canvas
com.ibm.icu.dev.demo.impl.DumbTextComponent
- All Implemented Interfaces:
FocusListener,KeyListener,MouseListener,MouseMotionListener,ImageObserver,MenuContainer,Serializable,EventListener,Accessible
- Direct Known Subclasses:
TransliteratingTextComponent
public class DumbTextComponent
extends Canvas
implements KeyListener, MouseListener, MouseMotionListener, FocusListener
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Canvas
Canvas.AccessibleAWTCanvasNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Pointprivate intprivate Imageprivate Pointprivate BreakIteratorprivate Stringprivate static final charprivate static booleanprivate booleanprivate booleanprivate Pointprivate FontMetricsprivate booleanprivate intprivate intprivate intprivate BreakIteratorprivate intprivate intprivate intprivate int[]private static final intprivate Dimensionprivate booleanprivate booleanprivate Selectionprivate ActionListenerprivate static final longFor serializationprivate Pointprivate Selectionprivate TextListenerprivate booleanprivate BreakIteratorprivate intprivate intFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoid(package private) voidcopy()voiddrawSelection(Graphics g, String lastSubstring) private intfindFittingBreak(FontMetrics fMtr, String line, int width, BreakIterator breaker) LIU: Finds the longest substring that fits a given width composed of subunits returned by a BreakIterator.private intfindLine(int off, boolean start) private voidfixHex()private voidfixLineStarts(int width) voidvoidprotected intintintgetText()protected voidstatic Stringhex(char ch) voidinsertText(String text) booleanvoidvoidvoidprivate intlineDelta(int off, int delta) LIU: Given an offset into contents, moves up or down by lines, according to lineStarts[].voidvoidvoidvoidvoidvoidvoidintnextLine(FontMetrics fMtr, int start, int width) offset2Point(int off, boolean start, Point p) voidvoid(package private) void(package private) voidpaste()point2Offset(Point p, Selection o) voidvoidvoidreplaceRange(String s, int start, int end) voidselect(int start, int end) voidselect(int start, int end, boolean clickAfter) voidvoidselect(MouseEvent e, boolean first) voidsetBounds(int x, int y, int w, int h) voidsetEditable(boolean b) voidprotected voidsetKeyStart(int keyStart) voidvoidvoidprotected voidintvisibleWidth(FontMetrics fMtr, String s) Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategyMethods 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 Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization- See Also:
-
DEBUG
private static transient boolean DEBUG -
contents
-
selection
-
activeStart
private int activeStart -
editable
private boolean editable -
tempSelection
-
focus
private transient boolean focus -
lineBreaker
-
wordBreaker
-
charBreaker
-
lineAscent
private transient int lineAscent -
lineHeight
private transient int lineHeight -
lineLeading
private transient int lineLeading -
lastHeight
private transient int lastHeight -
lastWidth
private transient int lastWidth -
MAX_LINES
private static final int MAX_LINES- See Also:
-
lineStarts
private transient int[] lineStarts -
lineCount
private transient int lineCount -
valid
private transient boolean valid -
fm
-
redoLines
private transient boolean redoLines -
doubleClick
private transient boolean doubleClick -
textListener
-
selectionListener
-
cacheImage
-
mySize
-
xInset
private transient int xInset -
yInset
private transient int yInset -
startPoint
-
endPoint
-
caretPoint
-
activePoint
-
CR
private static final char CR- See Also:
-
pressed
private transient boolean pressed
-
-
Constructor Details
-
DumbTextComponent
public DumbTextComponent()
-
-
Method Details
-
addActionListener
-
removeActionListener
-
addTextListener
-
removeTextListener
-
mousePressed
- Specified by:
mousePressedin interfaceMouseListener
-
mouseDragged
- Specified by:
mouseDraggedin interfaceMouseMotionListener
-
mouseReleased
- Specified by:
mouseReleasedin interfaceMouseListener
-
mouseEntered
- Specified by:
mouseEnteredin interfaceMouseListener
-
mouseExited
- Specified by:
mouseExitedin interfaceMouseListener
-
mouseClicked
- Specified by:
mouseClickedin interfaceMouseListener
-
mouseMoved
- Specified by:
mouseMovedin interfaceMouseMotionListener
-
focusGained
- Specified by:
focusGainedin interfaceFocusListener
-
focusLost
- Specified by:
focusLostin interfaceFocusListener
-
select
-
keyPressed
- Specified by:
keyPressedin interfaceKeyListener
-
copy
void copy() -
paste
void paste() -
lineDelta
private int lineDelta(int off, int delta) LIU: Given an offset into contents, moves up or down by lines, according to lineStarts[].- Parameters:
off- the offset into contentsdelta- how many lines to move up (invalid input: '<' 0) or down (> 0)- Returns:
- the new offset into contents
-
keyReleased
- Specified by:
keyReleasedin interfaceKeyListener
-
keyTyped
- Specified by:
keyTypedin interfaceKeyListener
-
handleKeyTyped
-
setKeyStart
protected void setKeyStart(int keyStart) -
validateKeyStart
protected void validateKeyStart() -
getKeyStart
protected int getKeyStart() -
setEditable
public void setEditable(boolean b) -
isEditable
public boolean isEditable() -
select
-
select
public void select(int start, int end) -
select
public void select(int start, int end, boolean clickAfter) -
getSelectionStart
public int getSelectionStart() -
getSelectionEnd
public int getSelectionEnd() -
setBounds
public void setBounds(int x, int y, int w, int h) -
getPreferredSize
- Overrides:
getPreferredSizein classComponent
-
getMaximumSize
- Overrides:
getMaximumSizein classComponent
-
getMinimumSize
- Overrides:
getMinimumSizein classComponent
-
setText
-
setText2
-
insertText
-
replaceRange
-
getText
-
setFont
-
update
-
paint
-
paint2
-
paintRect
-
drawSelection
-
offset2Point
-
findLine
private int findLine(int off, boolean start) -
point2Offset
-
fixLineStarts
private void fixLineStarts(int width) -
nextLine
-
findFittingBreak
LIU: Finds the longest substring that fits a given width composed of subunits returned by a BreakIterator. If the smallest subunit is too long, returns 0.- Parameters:
fMtr- metrics to useline- the string to be fix into widthwidth- line.substring(0, result) must be invalid input: '<'= widthbreaker- the BreakIterator that will be used to find subunits- Returns:
- maximum characters, at boundaries returned by breaker, that fit into width, or zero on failure
-
visibleWidth
-
fixHex
private void fixHex() -
hex
-