java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.autogui.swing.util.TextCellRenderer<ValueType>
- Type Parameters:
ValueType
- the type of cell values
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,ListCellRenderer<ValueType>
,TableCellRenderer
- Direct Known Subclasses:
GuiSwingLogEntryException.ExceptionMessageRenderer
,GuiSwingLogEntryException.ExceptionStackTraceRenderer
,GuiSwingLogEntryProgress.ProgressMessageRenderer
,GuiSwingLogEntryProgress.ProgressStatusRenderer
,GuiSwingLogEntryString.GuiSwingLogStringRenderer
public class TextCellRenderer<ValueType>
extends JPanel
implements TableCellRenderer, ListCellRenderer<ValueType>
multi-line text cell renderer for JList and JTable
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
a line holdingAttributedString
static class
focusing information for a matched pattern positionNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected float
protected float
protected Pattern
protected String
protected boolean
protected TextCellRenderer.LineInfoMatch
protected List
<TextCellRenderer.LineInfo> protected int
protected Color
protected boolean
protected Color
protected int
protected Color
protected int
protected BufferedImage
protected String
protected ValueType
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_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
int
buildLines
(String text, List<TextCellRenderer.LineInfo> lines) float[]
multiply maxWidth set bybuildFromValue()
and size of lines by base char size (getBaseSize()
) , and border size bygetBorderSize()
void
static Border
createBorder
(int top, int left, int bottom, int right) the sizes of the border will be scaled; if non 0 size is specified, the minimum becomes 1.static Border
createBorder
(int top, int left, int bottom, int right, Color background) the sizes of the border will be scaled; if non 0 size is specified, the minimum becomes 1.static Border
createCellTableBorderOuter
(JTable table, int column, Color color) -------------------------------- | matte(color) top=1, left=(2 or 0), right=(2 or 0), bottom=2 //changed by the column index | [cell] | ---------------------------------------createLine
(TextCellRenderer.LineInfo prevLine, int lineIndex, int start, String line) create a line-infostatic <V> int
findTextForComposition
(V value, String findKeyword, TextCellRenderer<V>... rs) formatPreProcess
(String line) remove tabs from the line; for avoiding displaying tofu by AttributedStringfloat[]
int[]
static Color
getCellBackground
(JComponent component, boolean isTable, int row) getFocusNextFound
(ValueType value, Object prevIndex, boolean forward) focus next matched range and return it.static <V> Object
getFocusNextFoundForComposition
(V value, Object prevIndex, boolean forward, TextCellRenderer<V>... rs) static Color
getGridColor
(Color background) modify the background color for grid-separator: a bright color becomes darker, a dark color becomes brighterint
getLines()
getListCellRendererComponent
(JList<? extends ValueType> list, ValueType value, int index, boolean isSelected, boolean cellHasFocus) static <V> String
getSelectedTextForComposition
(V value, boolean entireText, Map<TextCellRenderer<?>, int[]> rangesOpt, TextCellRenderer<V>... rs) getTableCellRendererComponent
(JTable tableNullable, Object value, boolean isSelected, boolean hasFocus, int row, int column) getText()
getValue()
protected void
protected void
static boolean
isCellTableEnd
(JTable table, int column, boolean left) boolean
isLastMatch
(int lineIndex, int rangeIndex) boolean
isValueSame
(ValueType value, boolean forMouseEvents) static <V> void
mouseUpdateForComposition
(V value, Map<TextCellRenderer<?>, int[]> ranges, boolean pressInit, Component pointComponent, Point point, TextCellRenderer<V>... rs) change selection range by mouse pressing, dragging or releasing.void
paintCellSelection
(Graphics g, Color selectionColor) protected void
void
paintLineFinds
(Graphics2D g2, TextCellRenderer.LineInfo line, TextLayout l, int lineIndex, Color findColor, Color findMatchColor, float lineX) void
paintLineSelection
(Graphics2D g2, TextCellRenderer.LineInfo line, TextLayout l, Color selectionColor, float lineX) protected float[]
paintOrLayoutComponentLines
(Graphics g, boolean paint) static void
paintRowsBorderSelection
(JTable table, Graphics2D g2) draw additional round highlighting rectangles for selected rows.void
float
paintStartX
(int lineIndex, TextCellRenderer.LineInfo prev, float prevX, TextCellRenderer.LineInfo line, TextLayout l, FontRenderContext frc) void
setBackground
(Color bg) static void
setCellBorderDefault
(boolean isTable, JComponent cell, boolean isSelected, boolean hasFocus) the fallback impl.static void
setCellDefaultProperties
(JComponent cellComponent) setting properties for renderersstatic void
setCellListColor
(JList<?> list, JComponent component, boolean isSelected, boolean hasFocus, int row) static boolean
setCellListColorDropTarget
(JList<?> list, JComponent component, int row) static boolean
setCellTableBorder
(JTable table, JComponent cell, boolean isSelected, boolean hasFocus, int row, int column) the method totally replacing the border with a new one when it returns true.static void
setCellTableBorderWithMargin
(JTable table, JComponent cell, boolean isSelected, boolean hasFocus, int row, int column) ---------------------------- | matte(alternativeColor) top=1, left=(2 or 0), right=(2 or 0), bottom=2 | matte(cell.background) top=1, left=10, right=5, bottom=1 | empty top=10, left=10, right=10, bottom=5 | [cell]static void
setCellTableColor
(JTable table, JComponent component, boolean isSelected, boolean hasFocus, int row, int column) static boolean
setCellTableColorDropTarget
(JTable table, JComponent component, int row, int column) static void
setCellTableMargin
(JComponent cell) ------------------------ | existing-border | empty top=7, left=8, right=8, bottom=8 | [cell]protected void
setDefaultAttributes
(AttributedString a, int len) int
constructs find-ranges for each line matched by findPattern.void
setProperty
(JList<?> list) void
setProperty
(JTable list) void
setSelectionBackground
(Color selectionBackground) void
setSelectionForeground
(Color selectionForeground) void
setSelectionFromValue
(ValueType value) in the class, just callsetFindHighlights()
void
setSelectionRange
(int from, int to) boolean
static <V> void
setValueForComposition
(V value, Map<TextCellRenderer<?>, int[]> rangesOpt, boolean forMouseEvents, TextCellRenderer<V>... rs) boolean
updateFindPattern
(String findKeyword) update findText and findPatternboolean
updateFindPattern
(Pattern newPattern) update findPattern.static <V> boolean
updateFindPatternForComposition
(String findKeyword, TextCellRenderer<V>... rs) static void
wrapBorder
(JComponent component, Border border, boolean inside) Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods 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, validateTree
Methods 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, 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, 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, processFocusEvent, 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, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
selected
protected boolean selected -
selectionStart
protected int selectionStart -
selectionEnd
protected int selectionEnd -
lines
-
testImage
-
baseWidth
protected float baseWidth -
baseHeight
protected float baseHeight -
value
-
forMouseEvents
protected boolean forMouseEvents -
text
-
findText
-
findPattern
-
maxWidth
protected int maxWidth -
lastMatch
-
selectionForeground
-
selectionBackground
-
originalBackground
- Since:
- 1.2
-
textToBackToColor
-
-
Constructor Details
-
TextCellRenderer
public TextCellRenderer()
-
-
Method Details
-
initColor
protected void initColor() -
initBorder
protected void initBorder() -
getText
-
getTextSelection
-
getValue
-
getLines
-
getFindPattern
-
getListCellRendererComponent
public Component getListCellRendererComponent(JList<? extends ValueType> list, ValueType value, int index, boolean isSelected, boolean cellHasFocus) - Specified by:
getListCellRendererComponent
in interfaceListCellRenderer<ValueType>
-
setProperty
-
setProperty
-
setBackground
- Overrides:
setBackground
in classJComponent
-
setCellDefaultProperties
setting properties for renderers- Parameters:
cellComponent
- the target component- Since:
- 1.6
-
setCellListColor
public static void setCellListColor(JList<?> list, JComponent component, boolean isSelected, boolean hasFocus, int row) - Parameters:
list
- the target list, nullablecomponent
- the cell componentisSelected
- true if the cell is selectedhasFocus
- true if the cell has focusrow
- the row index of the cell- Since:
- 1.2
-
setCellListColorDropTarget
- Parameters:
list
- the listcomponent
- the cell componentrow
- the row index- Returns:
- true if drop target
- Since:
- 1.2
-
setCellTableColor
public static void setCellTableColor(JTable table, JComponent component, boolean isSelected, boolean hasFocus, int row, int column) - Parameters:
table
- the target table, nullablecomponent
- the cell componentisSelected
- true if the cell is selectedhasFocus
- true if the cell has focusrow
- the row index of the cellcolumn
- the column index of the cell- Since:
- 1.2
-
setCellTableColorDropTarget
public static boolean setCellTableColorDropTarget(JTable table, JComponent component, int row, int column) - Parameters:
table
- the tablecomponent
- the cell componentrow
- the row indexcolumn
- the column index- Returns:
- true if drop target
- Since:
- 1.2
-
setCellTableBorderWithMargin
public static void setCellTableBorderWithMargin(JTable table, JComponent cell, boolean isSelected, boolean hasFocus, int row, int column) ---------------------------- | matte(alternativeColor) top=1, left=(2 or 0), right=(2 or 0), bottom=2 | matte(cell.background) top=1, left=10, right=5, bottom=1 | empty top=10, left=10, right=10, bottom=5 | [cell]
- Parameters:
table
- the tablecell
- the target cellisSelected
- true if the cell is selectedhasFocus
- true if the cell has focusrow
- the row index of the cellcolumn
- the column index of the cell- Since:
- 1.6
-
setCellTableBorder
public static boolean setCellTableBorder(JTable table, JComponent cell, boolean isSelected, boolean hasFocus, int row, int column) the method totally replacing the border with a new one when it returns true.-------------------------------- | empty top=7, left=8, right=8, bottom=8 | [cell] | ... ---------------------------------------
Currently, the true case is only the macOS SystemLAF.- Parameters:
table
- the tablecell
- the target cellisSelected
- true if the cell is selectedhasFocus
- true if the cell has focusrow
- the row index of the cellcolumn
- the column index of the cell- Returns:
- true if succeeded
- Since:
- 1.2
-
createCellTableBorderOuter
-------------------------------- | matte(color) top=1, left=(2 or 0), right=(2 or 0), bottom=2 //changed by the column index | [cell] | ---------------------------------------
- Parameters:
table
- the tablecolumn
- the target columncolor
- the border color- Returns:
- matte border
- Since:
- 1.6
-
isCellTableEnd
- Parameters:
table
- the tablecolumn
- the target columnleft
- the checked end- Returns:
- true if index == 0 and left, or index is count-1 and !left
- Since:
- 1.6
-
setCellTableMargin
------------------------ | existing-border | empty top=7, left=8, right=8, bottom=8 | [cell]
- Parameters:
cell
- the target cell- Since:
- 1.6
-
getGridColor
modify the background color for grid-separator: a bright color becomes darker, a dark color becomes brighter- Parameters:
background
- the color obtained fromComponent.getBackground()
- Returns:
- the modified color
- Since:
- 1.6
-
wrapBorder
- Parameters:
component
- the border holderborder
- the appended borderinside
- if true the border will be the inside of the existing border- Since:
- 1.6
-
createBorder
the sizes of the border will be scaled; if non 0 size is specified, the minimum becomes 1.- Parameters:
top
- the top sizeleft
- the left sizebottom
- the bottom sizeright
- the right size- Returns:
- empty-border
- Since:
- 1.6
-
createBorder
the sizes of the border will be scaled; if non 0 size is specified, the minimum becomes 1.- Parameters:
top
- the top sizeleft
- the left sizebottom
- the bottom sizeright
- the right sizebackground
- the border color- Returns:
- matte-border
- Since:
- 1.6
-
getCellBackground
- Parameters:
component
- the table or listisTable
- true if the component is a tablerow
- the row index- Returns:
- background color for the row
- Since:
- 1.2
-
setCellBorderDefault
public static void setCellBorderDefault(boolean isTable, JComponent cell, boolean isSelected, boolean hasFocus) the fallback impl. for returning false bysetCellTableBorder(JTable, JComponent, boolean, boolean, int, int)
- Parameters:
isTable
- true if a table cellcell
- the cell componentisSelected
- the cell is selectedhasFocus
- the cell has focus- Since:
- 1.2
-
paintRowsBorderSelection
draw additional round highlighting rectangles for selected rows. the method can be called after execution ofJComponent.paintComponent(Graphics)
- Parameters:
table
- the target tableg2
- the target context- Since:
- 1.6
-
getTableCellRendererComponent
public Component getTableCellRendererComponent(JTable tableNullable, Object value, boolean isSelected, boolean hasFocus, int row, int column) - Specified by:
getTableCellRendererComponent
in interfaceTableCellRenderer
-
setValue
called fromgetTableCellRendererComponent(JTable, Object, boolean, boolean, int, int)
(alsogetListCellRendererComponent(JList, Object, int, boolean, boolean)
)- check the value by
isValueSame(Object, boolean)
. if the value is same, returns false - updates value and text with
format(Object)
buildFromValue()
: constructsTextCellRenderer.LineInfo
s (buildLines(String, List)
andcreateLine(LineInfo, int, int, String)
), and update preferredSize withbuildSize()
. Also, if forMouseEvents is false,setSelectionFromValue(Object)
- Parameters:
value
- a new valueforMouseEvents
-setSelectionFromValue(Object)
will be skipped- Returns:
- true if updated
- check the value by
-
isValueSame
-
format
- Parameters:
value
- the source value- Returns:
- the formatted line: should be processed by
formatPreProcess(String)
-
buildFromValue
public void buildFromValue() -
buildLines
- Parameters:
text
- source textlines
- cleared and appended- Returns:
- max size of
TextCellRenderer.LineInfo.getWidth()
in the lines
-
formatPreProcess
remove tabs from the line; for avoiding displaying tofu by AttributedString- Parameters:
line
- a line string without newlines- Returns:
- remove tabs
- Since:
- 1.2
-
createLine
public TextCellRenderer.LineInfo createLine(TextCellRenderer.LineInfo prevLine, int lineIndex, int start, String line) create a line-info- Parameters:
prevLine
- a previous line-info or null for first linelineIndex
- the line number indexstart
- the start position of the lineline
- the line string without new-line- Returns:
- a created line info for the line
-
buildSize
public float[] buildSize()multiply maxWidth set bybuildFromValue()
and size of lines by base char size (getBaseSize()
) , and border size bygetBorderSize()
- Returns:
- {width, height}
-
setSelectionFromValue
in the class, just callsetFindHighlights()
- Parameters:
value
- the new value
-
clearSelectionRange
public void clearSelectionRange() -
setSelectionRange
public void setSelectionRange(int from, int to) -
setFindHighlights
public int setFindHighlights()constructs find-ranges for each line matched by findPattern. thus,updateFindPattern(String)
orupdateFindPattern(Pattern)
needs to be called before.- Returns:
- number of matched portions
-
updateFindPattern
update findPattern. findText becomes null- Parameters:
newPattern
- a new pattern- Returns:
- true if updated.
-
updateFindPattern
update findText and findPattern- Parameters:
findKeyword
- a new string, nullable- Returns:
- true if the string is updated. if true, it needs to be called
setFindHighlights()
-
getFocusNextFound
focus next matched range and return it.m = null; m = getFocusNextFound(v, m, true); m = getFocusNextFound(v, m, true); ...
- Parameters:
value
- the value to be setprevIndex
- the previous focus object or initially nullforward
- true for forward or false for backward- Returns:
- a focus object
TextCellRenderer.LineInfoMatch
or null
-
mouseUpdateForComposition
@SafeVarargs public static <V> void mouseUpdateForComposition(V value, Map<TextCellRenderer<?>, int[]> ranges, boolean pressInit, Component pointComponent, Point point, TextCellRenderer<V>... rs) change selection range by mouse pressing, dragging or releasing. each rs values will be updated bysetValue(Object, boolean)
with forMouseEvents=true. update map entries of range and selection-range of rs bysetSelectionRange(int, int)
- Type Parameters:
V
- the type of cell values- Parameters:
value
- the value to be set for each rsranges
- updated rangespressInit
- if true, it means first pressing and clear ranges and updates both "from" and "to". otherwise just updates "to"pointComponent
- the coordinate base of pointpoint
- a point in pointComponentrs
- components within pointComponent
-
updateFindPatternForComposition
@SafeVarargs public static <V> boolean updateFindPatternForComposition(String findKeyword, TextCellRenderer<V>... rs) -
findTextForComposition
@SafeVarargs public static <V> int findTextForComposition(V value, String findKeyword, TextCellRenderer<V>... rs) -
getFocusNextFoundForComposition
@SafeVarargs public static <V> Object getFocusNextFoundForComposition(V value, Object prevIndex, boolean forward, TextCellRenderer<V>... rs) -
setValueForComposition
@SafeVarargs public static <V> void setValueForComposition(V value, Map<TextCellRenderer<?>, int[]> rangesOpt, boolean forMouseEvents, TextCellRenderer<V>... rs) -
getSelectedTextForComposition
@SafeVarargs public static <V> String getSelectedTextForComposition(V value, boolean entireText, Map<TextCellRenderer<?>, int[]> rangesOpt, TextCellRenderer<V>... rs) -
getBaseSize
public float[] getBaseSize() -
setDefaultAttributes
-
getBorderSize
public int[] getBorderSize() -
getSelectionBackground
-
getSelectionForeground
-
setSelectionBackground
-
setSelectionForeground
-
getLineFindColor
-
getLineFindMatchColor
-
paintOrLayoutComponentLines
- Parameters:
g
- the target graphicspaint
- if true, do drawing. if false, it just calculates the size- Returns:
- width and height
- Since:
- 1.2
-
paintComponent
- Overrides:
paintComponent
in classJComponent
-
paintSetUpGraphics
-
paintLineSelection
public void paintLineSelection(Graphics2D g2, TextCellRenderer.LineInfo line, TextLayout l, Color selectionColor, float lineX) -
paintLineFinds
public void paintLineFinds(Graphics2D g2, TextCellRenderer.LineInfo line, TextLayout l, int lineIndex, Color findColor, Color findMatchColor, float lineX) -
isLastMatch
public boolean isLastMatch(int lineIndex, int rangeIndex) -
paintStartX
public float paintStartX(int lineIndex, TextCellRenderer.LineInfo prev, float prevX, TextCellRenderer.LineInfo line, TextLayout l, FontRenderContext frc) -
paintCellSelection
-
getIndex
- Parameters:
point
- the component coordinate- Returns:
- the character index for the point
-