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 Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields 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 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.JComponent
addAncestorListener, 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.Container
add, 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.Component
action, 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
-
RMTextArea
public RMTextArea()Creates a new text area.
-
-
Method Details
-
getMargin
Returns the text margins. -
setMargin
Sets the text margins. -
getTextBounds
Returns the text rect. -
getLineWrap
public boolean getLineWrap()Returns whether to wrap lines to pane width. -
setLineWrap
public void setLineWrap(boolean aValue) Sets whether to wrap lines to pane width. -
getTextEditor
Returns the text editor associated with this text area. -
setTextEditor
Sets the text editor associated with this text area. -
createTextEditor
Creates a new text editor. -
getText
Returns text string of text editor. -
setText
Set text string of text editor. -
append
Append Text. -
appendln
Append Text. -
append
Appends an XString. -
length
public int length()Returns the text length. -
getXString
Convenience - returns text editor string. -
setXString
Convenience - sets text editor string. -
getNumberFormat
-
getDateFormat
-
setDateFormat
-
setNumberFormat
-
getFontScale
public double getFontScale()Convenience - returns text editor font scale. -
setFontScale
public void setFontScale(double aScale) Convenience - sets text editor font scale. -
propertyChange
When text editor changes Selection or XString changes Runs or XStringRuns change Chars/Attribute, repaint.- Specified by:
propertyChangein interfacePropertyChangeListener
-
processComponentKeyEvent
Overrides JComponent to forward key event to text editor.- Overrides:
processComponentKeyEventin classJComponent
-
processMouseEvent
Overrides JComponent method to forward mouse pressed/released to text editor.- Overrides:
processMouseEventin classJComponent
-
processFocusEvent
Override to show hidden cursor.- Overrides:
processFocusEventin classComponent
-
processMouseMotionEvent
Overrides JComponent method to forward mouse drags to text editor.- Overrides:
processMouseMotionEventin classJComponent
-
showCursor
public void showCursor()Shows the cursor. -
hideCursor
public void hideCursor()Hides the cursor. -
isManagingFocus
public boolean isManagingFocus()Overrides JComponent method so we get VK_TAB events.- Overrides:
isManagingFocusin classJComponent
-
paintComponent
Overrides JComponent to paint text editor text.- Overrides:
paintComponentin classJComponent
-
paintText
Paints the layout in a given graphics. -
paintTextRun
Paints the layout in a given graphics. -
paintTextEditor
Paints a given layout in a given graphics. -
paintBackground
Paints background. -
setRenderingHints
Sets rendering hints for text render. -
getMinimumSize
Overrides JComponent method to declare minimum size to be current size.- Overrides:
getMinimumSizein classJComponent
-
getPreferredSize
Overrides JComponent method to declare preferred size to be text editor's optimal height.- Overrides:
getPreferredSizein classJComponent
-
setBounds
public void setBounds(int x, int y, int w, int h) Overrides JComponent method to tell text editor the bounds. -
getPreferredScrollableViewportSize
Scrollable method.- Specified by:
getPreferredScrollableViewportSizein interfaceScrollable
-
getScrollableTracksViewportWidth
public boolean getScrollableTracksViewportWidth()Scrollable method.- Specified by:
getScrollableTracksViewportWidthin interfaceScrollable
-
getScrollableTracksViewportHeight
public boolean getScrollableTracksViewportHeight()Scrollable method.- Specified by:
getScrollableTracksViewportHeightin interfaceScrollable
-
getScrollableBlockIncrement
Scrollable method.- Specified by:
getScrollableBlockIncrementin interfaceScrollable
-
getScrollableUnitIncrement
Scrollable method.- Specified by:
getScrollableUnitIncrementin interfaceScrollable
-
dragEnter
DropTargetListener method.- Specified by:
dragEnterin interfaceDropTargetListener
-
dragExit
DropTargetListener method.- Specified by:
dragExitin interfaceDropTargetListener
-
dragOver
DropTargetListener method.- Specified by:
dragOverin interfaceDropTargetListener
-
drop
DropTargetListener method.- Specified by:
dropin interfaceDropTargetListener
-
dropActionChanged
DropTargetListener method.- Specified by:
dropActionChangedin interfaceDropTargetListener
-
setSel
public void setSel(int newStartEnd) Sets the character index of the text cursor. -
setSel
public void setSel(int aStart, int anEnd) Sets the character index of the start and end of the text selection. -
getSelStart
public int getSelStart()Returns the selection start. -
getSelEnd
public int getSelEnd()Returns the selection end. -
getSelAnchor
public int getSelAnchor()Returns the selection anchor. -
getCharIndex
Returns the char index for given point in text coordinate space. -
getFont
Return AWT Font for current selection.- Specified by:
getFontin interfaceMenuContainer- Overrides:
getFontin classComponent
-
setFont
Set AWT Font for current selection.- Overrides:
setFontin classJComponent
-