org.gjt.sp.jedit.textarea
Class Gutter

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--org.gjt.sp.jedit.textarea.Gutter
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.swing.SwingConstants

public class Gutter
extends javax.swing.JComponent
implements javax.swing.SwingConstants

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
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 javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NORTH, NORTH_EAST, NORTH_WEST, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Gutter(JEditTextArea textArea, TextAreaDefaults defaults)
           
 
Method Summary
 javax.swing.JPopupMenu getContextMenu()
           
 int getGutterWidth()
          Get the width of the expanded gutter
 java.awt.Color getHighlightedForeground()
          Get the foreground color for highlighted line numbers
 int getHighlightInterval()
          Sets the number of lines between highlighted line numbers.
 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 isLineNumberingEnabled()
          Identifies whether or not the line numbers are drawn in the gutter
 void paintComponent(java.awt.Graphics gfx)
           
protected  void paintCustomHighlights(java.awt.Graphics gfx)
           
protected  void paintLineNumbers(java.awt.Graphics gfx)
           
 void setAntiAliasingEnabled(boolean on)
           
 void setBorder(javax.swing.border.Border border)
          JComponent.setBorder(Border) is overridden here to cache the left inset of the border (if any) to avoid having to fetch it during every repaint.
 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 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 setContextMenu(javax.swing.JPopupMenu context)
           
 void setFont(java.awt.Font font)
          JComponent.setFont(Font) is overridden here to cache the baseline for the font.
 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 setHighlightInterval(int interval)
          Sets the number of lines between 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 toggleCollapsed()
          Toggles whether the gutter is collapsed or expanded.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getUIClassID, getVerifyInputWhenFocusTarget, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, hide, isDoubleBuffered, isFocusCycleRoot, isFocusTraversable, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processFocusEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, imageUpdate, inside, isDisplayable, isEnabled, isLightweight, 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, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Gutter

public Gutter(JEditTextArea textArea,
              TextAreaDefaults defaults)
Method Detail

setAntiAliasingEnabled

public void setAntiAliasingEnabled(boolean on)

paintComponent

public void paintComponent(java.awt.Graphics gfx)
Overrides:
paintComponent in class javax.swing.JComponent

paintLineNumbers

protected void paintLineNumbers(java.awt.Graphics gfx)

paintCustomHighlights

protected void paintCustomHighlights(java.awt.Graphics gfx)

setBorder

public 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
Parameters:
width - The border width (in pixels)
color - The border color

setBorder

public void setBorder(javax.swing.border.Border border)
JComponent.setBorder(Border) is overridden here to cache the left inset of the border (if any) to avoid having to fetch it during every repaint.
Overrides:
setBorder in class javax.swing.JComponent

setFont

public void setFont(java.awt.Font font)
JComponent.setFont(Font) is overridden here to cache the baseline for the font. This avoids having to get the font metrics during every repaint.
Overrides:
setFont in class javax.swing.JComponent

setHighlightedForeground

public void setHighlightedForeground(java.awt.Color highlight)
Set the foreground color for highlighted line numbers
Parameters:
highlight - The highlight color

getHighlightedForeground

public java.awt.Color getHighlightedForeground()
Get the foreground color for highlighted line numbers
Returns:
The highlight color

setGutterWidth

public void setGutterWidth(int width)
Set the width of the expanded gutter
Parameters:
width - The gutter width

getGutterWidth

public int getGutterWidth()
Get the width of the expanded gutter
Returns:
The gutter width

getPreferredSize

public java.awt.Dimension getPreferredSize()
Overrides:
getPreferredSize in class javax.swing.JComponent

getMinimumSize

public java.awt.Dimension getMinimumSize()
Overrides:
getMinimumSize in class javax.swing.JComponent

isLineNumberingEnabled

public boolean isLineNumberingEnabled()
Identifies whether or not the line numbers are drawn in the gutter
Returns:
true if the line numbers are drawn, false otherwise

setLineNumberingEnabled

public void setLineNumberingEnabled(boolean enabled)
Turns the line numbering on or off and causes the gutter to be repainted.
Parameters:
enabled - true if line numbers are drawn, false otherwise

getLineNumberAlignment

public int getLineNumberAlignment()
Identifies whether the horizontal alignment of the line numbers.
Returns:
Gutter.RIGHT, Gutter.CENTER, Gutter.LEFT

setLineNumberAlignment

public void setLineNumberAlignment(int alignment)
Sets the horizontal alignment of the line numbers.
Parameters:
alignment - Gutter.RIGHT, Gutter.CENTER, Gutter.LEFT

isCollapsed

public boolean isCollapsed()
Identifies whether the gutter is collapsed or expanded.
Returns:
true if the gutter is collapsed, false if it is expanded

setCollapsed

public 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.
Parameters:
collapsed - true if the gutter is collapsed, false if it is expanded

toggleCollapsed

public void toggleCollapsed()
Toggles whether the gutter is collapsed or expanded.

getHighlightInterval

public int getHighlightInterval()
Sets the number of lines between highlighted line numbers.
Returns:
The number of lines between highlighted line numbers or zero if highlighting is disabled

setHighlightInterval

public void setHighlightInterval(int interval)
Sets the number of lines between highlighted line numbers. Any value less than or equal to one will result in highlighting being disabled.
Parameters:
interval - The number of lines between highlighted line numbers

getContextMenu

public javax.swing.JPopupMenu getContextMenu()

setContextMenu

public void setContextMenu(javax.swing.JPopupMenu context)