public class Gutter
extends javax.swing.JComponent
implements javax.swing.SwingConstants
javax.swing.JComponent.AccessibleJComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
Gutter(JEditor editor,
CodeEditorDefaults defaults) |
Modifier and Type | Method and Description |
---|---|
JEditor |
getEditor()
Return the Editor.
|
GutterHandler |
getGutterHandler()
Return the gutter handler which draws specific graphics and handles right clicks on the gutter.
|
int |
getGutterWidth()
Get the width of the expanded gutter
|
java.awt.Color |
getHighlightedForeground()
Get the foreground color for highlighted line numbers
|
int |
getLineNumber(int y)
Return the line number for an y position on the gutter.
|
int |
getLineNumberAlignment()
Identifies whether the horizontal alignment of the line numbers.
|
java.awt.Dimension |
getMinimumSize() |
java.awt.Dimension |
getPreferredSize() |
boolean |
isCollapsed()
Identifies whether the gutter is collapsed or expanded.
|
boolean |
isExpandable()
Identifies whether the gutter cab be collapsed or expanded.
|
boolean |
isLineNumberingEnabled()
Identifies whether or not the line numbers are drawn in the gutter
|
void |
paintComponent(java.awt.Graphics gfx) |
protected void |
paintLineNumbers(java.awt.Graphics gfx) |
void |
setAnchorMark(java.awt.Color mark) |
void |
setBorder(javax.swing.border.Border border) |
void |
setBorder(int width,
java.awt.Color color)
Convenience method for setting a default matte border on the right
with the specified border width and color
|
void |
setCaretMark(java.awt.Color mark) |
void |
setCollapsed(boolean collapsed)
Sets whether the gutter is collapsed or expanded and force the text
area to update its layout if there is a change.
|
void |
setDefaults(CodeEditorDefaults defaults)
Set the Gutter defaults.
|
void |
setExpandable(boolean expandable)
Sets whether the gutter can be expanded or colllapses.
|
void |
setFont(java.awt.Font font) |
void |
setGutterHandler(GutterHandler gutterHandler)
Set the gutter handler for drawing specific graphcis and handling right clicks on the gutter.
|
void |
setGutterWidth(int width)
Set the width of the expanded gutter
|
void |
setHighlightedForeground(java.awt.Color highlight)
Set the foreground color for highlighted line numbers
|
void |
setLineNumberAlignment(int alignment)
Sets the horizontal alignment of the line numbers.
|
void |
setLineNumberingEnabled(boolean enabled)
Turns the line numbering on or off and causes the gutter to be
repainted.
|
void |
setSelectionMark(java.awt.Color mark) |
void |
toggleCollapsed()
Toggles whether the gutter is collapsed or expanded.
|
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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, 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, setBackground, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
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
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, 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, 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, transferFocusBackward, transferFocusUpCycle
public Gutter(JEditor editor, CodeEditorDefaults defaults)
public void setDefaults(CodeEditorDefaults defaults)
defaults
- the defaultspublic JEditor getEditor()
public void setGutterHandler(GutterHandler gutterHandler)
AbstractGutterHandler
, the method will call the
AbstractGutterHandler.setGutter(org.jeditor.gui.Gutter)
method internally.gutterHandler
- the gutter handlerpublic GutterHandler getGutterHandler()
public void paintComponent(java.awt.Graphics gfx)
paintComponent
in class javax.swing.JComponent
public int getLineNumber(int y)
y
- the y positionprotected void paintLineNumbers(java.awt.Graphics gfx)
public void setBorder(int width, java.awt.Color color)
width
- The border width (in pixels)color
- The border colorpublic void setBorder(javax.swing.border.Border border)
setBorder
in class javax.swing.JComponent
public void setFont(java.awt.Font font)
setFont
in class javax.swing.JComponent
public void setHighlightedForeground(java.awt.Color highlight)
highlight
- The highlight colorpublic java.awt.Color getHighlightedForeground()
public void setCaretMark(java.awt.Color mark)
public void setAnchorMark(java.awt.Color mark)
public void setSelectionMark(java.awt.Color mark)
public void setGutterWidth(int width)
width
- The gutter widthpublic int getGutterWidth()
public java.awt.Dimension getPreferredSize()
getPreferredSize
in class javax.swing.JComponent
public java.awt.Dimension getMinimumSize()
getMinimumSize
in class javax.swing.JComponent
public boolean isLineNumberingEnabled()
public void setLineNumberingEnabled(boolean enabled)
enabled
- true if line numbers are drawn, false otherwisepublic int getLineNumberAlignment()
public void setLineNumberAlignment(int alignment)
alignment
- Gutter.RIGHT, Gutter.CENTER, Gutter.LEFTpublic boolean isCollapsed()
public void setCollapsed(boolean collapsed)
collapsed
- true if the gutter is collapsed,
false if it is expandedpublic void setExpandable(boolean expandable)
expandable
- true if the gutter can be expanded or collapsedpublic boolean isExpandable()
public void toggleCollapsed()
Copyright © 2016, 2017, 2018, 2019, 2023 Herve Girod. All Rights Reserved. Documentation and source under the MIT licence