|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
syntaxhighlight.JTextComponentRowHeader
public class JTextComponentRowHeader
A row header panel for JScrollPane showing the line numbers of
JTextComponent.
The text lines in JTextComponent must be fixed height.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class javax.swing.JPanel |
|---|
javax.swing.JPanel.AccessibleJPanel |
| Nested classes/interfaces inherited from class javax.swing.JComponent |
|---|
javax.swing.JComponent.AccessibleJComponent |
| Nested classes/interfaces inherited from class java.awt.Container |
|---|
java.awt.Container.AccessibleAWTContainer |
| Nested classes/interfaces inherited from class java.awt.Component |
|---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
| Field Summary | |
|---|---|
protected java.awt.Color |
borderColor
The color of the border that joint the gutter and the script text area. |
protected int |
borderWidth
The width of the border that joint the gutter and the script text area. |
protected javax.swing.text.Document |
document
The document of the text component. |
protected javax.swing.event.DocumentListener |
documentListener
The document listener for document. |
protected java.awt.Color |
highlightedColor
The background of the row when it is highlighted. |
protected java.util.List<java.lang.Integer> |
highlightedLineList
The list of line numbers that indicate which lines are needed to be highlighted. |
protected int |
largestRowNumber
The cached largest row number (for determine panel width panelWidth). |
protected int |
lineNumberOffset
The line number offset. |
protected boolean |
listenToDocumentUpdate
Indicator indicate whether it is listening to the document change events or not. |
protected int |
paddingLeft
The minimum padding from 'the leftmost of the line number text' to 'the left margin'. |
protected int |
paddingRight
The minimum padding from 'the rightmost of the line number text' to 'the right margin' (not to the gutter border). |
protected int |
panelWidth
The cached panel width. |
protected javax.swing.JScrollPane |
scrollPane
The JScrollPane that it be added into. |
protected java.lang.Object |
textAntiAliasing
The anti-aliasing setting of the line number text. |
protected javax.swing.text.JTextComponent |
textComponent
The text component to listen the change events on. |
protected int |
textComponentHeight
The cached text component height, for determine panel height. |
| Fields inherited from class javax.swing.JComponent |
|---|
accessibleContext, 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 |
|---|
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 | |
|---|---|
JTextComponentRowHeader(javax.swing.JScrollPane scrollPane,
javax.swing.text.JTextComponent textComponent)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
addHighlightedLine(int lineNumber)
Add highlighted line. |
void |
checkPanelSize()
Check whether the height of the row header panel match with the height of the text component or not. |
void |
clearHighlightedLine()
Clear highlighted lines. |
java.awt.Color |
getBorderColor()
The color of the border that joint the gutter and the script text area. |
int |
getBorderWidth()
The width of the border that joint the gutter and the script text area. |
java.awt.Color |
getHighlightedColor()
The background of the highlighted row. |
java.util.List<java.lang.Integer> |
getHighlightedLineList()
Get the list of highlighted lines. |
int |
getLineNumberOffset()
Get the line number offset |
int |
getPaddingLeft()
The minimum padding from the 'leftmost of the line number text' to the 'left margin'. |
int |
getPaddingRight()
The minimum padding from the 'rightmost of the line number text' to the 'right margin' (not to the gutter border). |
java.awt.Dimension |
getPreferredSize()
|
java.lang.Object |
getTextAntiAliasing()
The anti-aliasing setting of the line number text. |
boolean |
isListenToDocumentUpdate()
Check if it is listening to the document change events. |
void |
paint(java.awt.Graphics g)
|
void |
setBackground(java.awt.Color background)
The background of the panel. |
void |
setBorderColor(java.awt.Color borderColor)
The color of the border that joint the gutter and the script text area. |
void |
setBorderWidth(int borderWidth)
The width of the border that joint the gutter and the script text area. |
void |
setFont(java.awt.Font font)
The font of the line number. |
void |
setForeground(java.awt.Color foreground)
The color of the line number. |
void |
setHighlightedColor(java.awt.Color highlightedColor)
The background of the highlighted row. |
void |
setHighlightedLineList(java.util.List<java.lang.Integer> highlightedLineList)
Set highlighted lines. |
void |
setLineNumberOffset(int offset)
Set the line number offset. |
void |
setListenToDocumentUpdate(boolean listenToDocumentUpdate)
Set to listen to document change events or not. |
void |
setPaddingLeft(int paddingLeft)
The minimum padding from 'the leftmost of the line number text' to the 'left margin'. |
void |
setPaddingRight(int paddingRight)
The minimum padding from the 'rightmost of the line number text' to the 'right margin' (not to the gutter border). |
void |
setTextAntiAliasing(java.lang.Object textAntiAliasing)
The anti-aliasing setting of the line number text. |
protected void |
updatePanelSize()
Update the panel size. |
protected void |
validateTextComponentDocument()
Check if the 'document of the textComponent' has changed to another document or not. |
| 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, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, 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, 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, transferFocusBackward, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected java.lang.Object textAntiAliasing
RenderingHints.
protected java.awt.Color borderColor
protected java.awt.Color highlightedColor
protected int paddingLeft
protected int paddingRight
protected int borderWidth
protected javax.swing.JScrollPane scrollPane
protected javax.swing.text.JTextComponent textComponent
protected javax.swing.text.Document document
protected javax.swing.event.DocumentListener documentListener
document.
protected int panelWidth
protected int largestRowNumber
panelWidth).
protected int textComponentHeight
protected int lineNumberOffset
protected final java.util.List<java.lang.Integer> highlightedLineList
protected boolean listenToDocumentUpdate
| Constructor Detail |
|---|
public JTextComponentRowHeader(javax.swing.JScrollPane scrollPane,
javax.swing.text.JTextComponent textComponent)
scrollPane - the JScrollPane that it be added intotextComponent - the text component to listen the change events on| Method Detail |
|---|
protected void validateTextComponentDocument()
public void checkPanelSize()
updatePanelSize().
protected void updatePanelSize()
public void setFont(java.awt.Font font)
setFont in class javax.swing.JComponentpublic void setForeground(java.awt.Color foreground)
setForeground in class javax.swing.JComponentforeground - the colorpublic void setBackground(java.awt.Color background)
setBackground in class javax.swing.JComponentbackground - the colorpublic java.awt.Dimension getPreferredSize()
getPreferredSize in class javax.swing.JComponentpublic void paint(java.awt.Graphics g)
paint in class javax.swing.JComponentpublic java.lang.Object getTextAntiAliasing()
RenderingHints.
public void setTextAntiAliasing(java.lang.Object textAntiAliasing)
RenderingHints.
textAntiAliasing - the settingpublic java.awt.Color getBorderColor()
public void setBorderColor(java.awt.Color borderColor)
borderColor - the colorpublic java.awt.Color getHighlightedColor()
public void setHighlightedColor(java.awt.Color highlightedColor)
highlightedColor - the colorpublic int getPaddingLeft()
public void setPaddingLeft(int paddingLeft)
paddingLeft - the padding in pixelpublic int getPaddingRight()
public void setPaddingRight(int paddingRight)
paddingRight - the padding in pixelpublic int getBorderWidth()
public void setBorderWidth(int borderWidth)
borderWidth - the width in pixelpublic int getLineNumberOffset()
public void setLineNumberOffset(int offset)
offset - the offsetpublic java.util.List<java.lang.Integer> getHighlightedLineList()
public void setHighlightedLineList(java.util.List<java.lang.Integer> highlightedLineList)
highlightedLineList - the list that contain the highlighted linespublic boolean addHighlightedLine(int lineNumber)
lineNumber - the line number to highlight
List.add(Object)public void clearHighlightedLine()
public boolean isListenToDocumentUpdate()
public void setListenToDocumentUpdate(boolean listenToDocumentUpdate)
() after setting this to true.
listenToDocumentUpdate - true to listen on document change, false not
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||