Package com.inductiveautomation.rm.text
Class RMTextArea
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
com.inductiveautomation.rm.text.RMTextArea
- All Implemented Interfaces:
- DropTargetListener,- ImageObserver,- MenuContainer,- PropertyChangeListener,- Serializable,- EventListener,- Scrollable
public class RMTextArea
extends JComponent
implements Scrollable, DropTargetListener, PropertyChangeListener
A text editor subclass for editing text in a Swing component.
- See Also:
- 
Nested Class SummaryNested classes/interfaces inherited from class javax.swing.JComponentJComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.ContainerContainer.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.ComponentComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
- 
Field SummaryFields inherited from class javax.swing.JComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.ComponentaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserverABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAppends an XString.voidAppend Text.voidAppend Text.Creates a new text editor.voiddragEnter(DropTargetDragEvent dtde) DropTargetListener method.voiddragExit(DropTargetEvent dte) DropTargetListener method.voiddragOver(DropTargetDragEvent dtde) DropTargetListener method.voiddrop(DropTargetDropEvent dtde) DropTargetListener method.voidDropTargetListener method.intgetCharIndex(Point2D aPoint) Returns the char index for given point in text coordinate space.getFont()Return AWT Font for current selection.doubleConvenience - returns text editor font scale.booleanReturns whether to wrap lines to pane width.Returns the text margins.Overrides JComponent method to declare minimum size to be current size.Scrollable method.Overrides JComponent method to declare preferred size to be text editor's optimal height.intgetScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction) Scrollable method.booleanScrollable method.booleanScrollable method.intgetScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) Scrollable method.intReturns the selection anchor.intReturns the selection end.intReturns the selection start.getText()Returns text string of text editor.Returns the text rect.Returns the text editor associated with this text area.Convenience - returns text editor string.voidHides the cursor.booleanOverrides JComponent method so we get VK_TAB events.intlength()Returns the text length.protected voidpaintBackground(Graphics2D aGraphics) Paints background.voidOverrides JComponent to paint text editor text.protected voidpaintText(Graphics2D aGraphics) Paints the layout in a given graphics.voidPaints a given layout in a given graphics.protected voidpaintTextRun(Graphics2D g, RMTextRun aRun) Paints the layout in a given graphics.protected voidprocessComponentKeyEvent(KeyEvent anEvent) Overrides JComponent to forward key event to text editor.protected voidOverride to show hidden cursor.voidprocessMouseEvent(MouseEvent anEvent) Overrides JComponent method to forward mouse pressed/released to text editor.voidprocessMouseMotionEvent(MouseEvent anEvent) Overrides JComponent method to forward mouse drags to text editor.voidpropertyChange(PropertyChangeEvent anEvent) When text editor changes Selection or XString changes Runs or XStringRuns change Chars/Attribute, repaint.voidsetBounds(int x, int y, int w, int h) Overrides JComponent method to tell text editor the bounds.voidsetDateFormat(RMDateFormat format) voidSet AWT Font for current selection.voidsetFontScale(double aScale) Convenience - sets text editor font scale.voidsetLineWrap(boolean aValue) Sets whether to wrap lines to pane width.voidSets the text margins.voidsetNumberFormat(RMNumberFormat format) protected voidsetRenderingHints(Graphics2D aGraphics) Sets rendering hints for text render.voidsetSel(int newStartEnd) Sets the character index of the text cursor.voidsetSel(int aStart, int anEnd) Sets the character index of the start and end of the text selection.voidSet text string of text editor.voidSets the text editor associated with this text area.voidsetXString(RMXString aString) Convenience - sets text editor string.voidShows the cursor.Methods inherited from class javax.swing.JComponentaddAncestorListener, 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, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processKeyBinding, processKeyEvent, 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, update, updateUIMethods inherited from class java.awt.Containeradd, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, 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, validateTreeMethods inherited from class java.awt.Componentaction, 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, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
- 
Constructor Details- 
RMTextAreapublic RMTextArea()Creates a new text area.
 
- 
- 
Method Details- 
getMarginReturns the text margins.
- 
setMarginSets the text margins.
- 
getTextBoundsReturns the text rect.
- 
getLineWrappublic boolean getLineWrap()Returns whether to wrap lines to pane width.
- 
setLineWrappublic void setLineWrap(boolean aValue) Sets whether to wrap lines to pane width.
- 
getTextEditorReturns the text editor associated with this text area.
- 
setTextEditorSets the text editor associated with this text area.
- 
createTextEditorCreates a new text editor.
- 
getTextReturns text string of text editor.
- 
setTextSet text string of text editor.
- 
appendAppend Text.
- 
appendlnAppend Text.
- 
appendAppends an XString.
- 
lengthpublic int length()Returns the text length.
- 
getXStringConvenience - returns text editor string.
- 
setXStringConvenience - sets text editor string.
- 
getNumberFormat
- 
getDateFormat
- 
setDateFormat
- 
setNumberFormat
- 
getFontScalepublic double getFontScale()Convenience - returns text editor font scale.
- 
setFontScalepublic void setFontScale(double aScale) Convenience - sets text editor font scale.
- 
propertyChangeWhen text editor changes Selection or XString changes Runs or XStringRuns change Chars/Attribute, repaint.- Specified by:
- propertyChangein interface- PropertyChangeListener
 
- 
processComponentKeyEventOverrides JComponent to forward key event to text editor.- Overrides:
- processComponentKeyEventin class- JComponent
 
- 
processMouseEventOverrides JComponent method to forward mouse pressed/released to text editor.- Overrides:
- processMouseEventin class- JComponent
 
- 
processFocusEventOverride to show hidden cursor.- Overrides:
- processFocusEventin class- Component
 
- 
processMouseMotionEventOverrides JComponent method to forward mouse drags to text editor.- Overrides:
- processMouseMotionEventin class- JComponent
 
- 
showCursorpublic void showCursor()Shows the cursor.
- 
hideCursorpublic void hideCursor()Hides the cursor.
- 
isManagingFocuspublic boolean isManagingFocus()Overrides JComponent method so we get VK_TAB events.- Overrides:
- isManagingFocusin class- JComponent
 
- 
paintComponentOverrides JComponent to paint text editor text.- Overrides:
- paintComponentin class- JComponent
 
- 
paintTextPaints the layout in a given graphics.
- 
paintTextRunPaints the layout in a given graphics.
- 
paintTextEditorPaints a given layout in a given graphics.
- 
paintBackgroundPaints background.
- 
setRenderingHintsSets rendering hints for text render.
- 
getMinimumSizeOverrides JComponent method to declare minimum size to be current size.- Overrides:
- getMinimumSizein class- JComponent
 
- 
getPreferredSizeOverrides JComponent method to declare preferred size to be text editor's optimal height.- Overrides:
- getPreferredSizein class- JComponent
 
- 
setBoundspublic void setBounds(int x, int y, int w, int h) Overrides JComponent method to tell text editor the bounds.
- 
getPreferredScrollableViewportSizeScrollable method.- Specified by:
- getPreferredScrollableViewportSizein interface- Scrollable
 
- 
getScrollableTracksViewportWidthpublic boolean getScrollableTracksViewportWidth()Scrollable method.- Specified by:
- getScrollableTracksViewportWidthin interface- Scrollable
 
- 
getScrollableTracksViewportHeightpublic boolean getScrollableTracksViewportHeight()Scrollable method.- Specified by:
- getScrollableTracksViewportHeightin interface- Scrollable
 
- 
getScrollableBlockIncrementScrollable method.- Specified by:
- getScrollableBlockIncrementin interface- Scrollable
 
- 
getScrollableUnitIncrementScrollable method.- Specified by:
- getScrollableUnitIncrementin interface- Scrollable
 
- 
dragEnterDropTargetListener method.- Specified by:
- dragEnterin interface- DropTargetListener
 
- 
dragExitDropTargetListener method.- Specified by:
- dragExitin interface- DropTargetListener
 
- 
dragOverDropTargetListener method.- Specified by:
- dragOverin interface- DropTargetListener
 
- 
dropDropTargetListener method.- Specified by:
- dropin interface- DropTargetListener
 
- 
dropActionChangedDropTargetListener method.- Specified by:
- dropActionChangedin interface- DropTargetListener
 
- 
setSelpublic void setSel(int newStartEnd) Sets the character index of the text cursor.
- 
setSelpublic void setSel(int aStart, int anEnd) Sets the character index of the start and end of the text selection.
- 
getSelStartpublic int getSelStart()Returns the selection start.
- 
getSelEndpublic int getSelEnd()Returns the selection end.
- 
getSelAnchorpublic int getSelAnchor()Returns the selection anchor.
- 
getCharIndexReturns the char index for given point in text coordinate space.
- 
getFontReturn AWT Font for current selection.- Specified by:
- getFontin interface- MenuContainer
- Overrides:
- getFontin class- Component
 
- 
setFontSet AWT Font for current selection.- Overrides:
- setFontin class- JComponent
 
 
-