|
|||||||||
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
org.fife.ui.rtextarea.Gutter
public class Gutter
The gutter is the component on the left-hand side of the text area that displays optional information such as line numbers and icons (for bookmarks, debugging breakpoints, error markers, etc.).
To add icons to the gutter, you must first call
RTextScrollPane.setIconRowHeaderEnabled(boolean)
on the parent
scroll pane, to make the icon area visible. Then, you can add icons that
track either lines in the document, or offsets, via
addLineTrackingIcon(int, Icon)
and
addOffsetTrackingIcon(int, Icon)
, respectively. To remove an
icon you've added, use removeTrackingIcon(GutterIconInfo)
.
GutterIconInfo
,
Serialized FormNested Class Summary |
---|
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 |
---|
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 | |
---|---|
Gutter(RTextArea textArea)
Constructor. |
Method Summary | |
---|---|
GutterIconInfo |
addLineTrackingIcon(int line,
Icon icon)
Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers. |
GutterIconInfo |
addOffsetTrackingIcon(int offs,
Icon icon)
Adds an icon that tracks an offset in the document, and is displayed adjacent to the line numbers. |
Icon |
getBookmarkIcon()
Returns the icon to use for bookmarks. |
GutterIconInfo[] |
getBookmarks()
Returns the bookmarks known to this gutter. |
Color |
getBorderColor()
Returns the color of the "border" line. |
Color |
getLineNumberColor()
Returns the color to use to paint line numbers. |
Font |
getLineNumberFont()
Returns the font used for line numbers. |
int |
getLineNumberingStartIndex()
Returns the starting line's line number. |
boolean |
getLineNumbersEnabled()
Returns true if the line numbers are enabled and visible. |
Object[] |
getTrackingIcons(Point p)
Returns the tracking icons at the specified view position. |
boolean |
isBookmarkingEnabled()
Returns whether bookmarking is enabled. |
boolean |
isIconRowHeaderEnabled()
Returns whether the icon row header is enabled. |
void |
removeAllTrackingIcons()
Removes all tracking icons. |
void |
removeTrackingIcon(GutterIconInfo tag)
Removes the specified tracking icon. |
void |
setBookmarkIcon(Icon icon)
Sets the icon to use for bookmarks. |
void |
setBookmarkingEnabled(boolean enabled)
Sets whether bookmarking is enabled. |
void |
setBorderColor(Color color)
Sets the color for the "border" line. |
void |
setComponentOrientation(ComponentOrientation o)
|
void |
setLineNumberColor(Color color)
Sets the color to use to paint line numbers. |
void |
setLineNumberFont(Font font)
Sets the font used for line numbers. |
void |
setLineNumberingStartIndex(int index)
Sets the starting line's line number. |
boolean |
toggleBookmark(int line)
Programatically toggles whether there is a bookmark for the specified line. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Gutter(RTextArea textArea)
textArea
- The parent text area.Method Detail |
---|
public GutterIconInfo addLineTrackingIcon(int line, Icon icon) throws BadLocationException
line
- The line to track (zero-based).icon
- The icon to display. This should be small (say 16x16).
removeTrackingIcon(GutterIconInfo)
to remove this
icon.
BadLocationException
- If offs
is an invalid offset
into the text area.addOffsetTrackingIcon(int, Icon)
,
removeTrackingIcon(GutterIconInfo)
public GutterIconInfo addOffsetTrackingIcon(int offs, Icon icon) throws BadLocationException
offs
- The offset to track.icon
- The icon to display. This should be small (say 16x16).
BadLocationException
- If offs
is an invalid offset
into the text area.addLineTrackingIcon(int, Icon)
,
removeTrackingIcon(GutterIconInfo)
public Icon getBookmarkIcon()
null
,
bookmarking is effectively disabled.setBookmarkIcon(Icon)
,
isBookmarkingEnabled()
public GutterIconInfo[] getBookmarks()
public Color getBorderColor()
setBorderColor(Color)
public Color getLineNumberColor()
setLineNumberColor(Color)
public Font getLineNumberFont()
setLineNumberFont(Font)
public int getLineNumberingStartIndex()
1
.
setLineNumberingStartIndex(int)
public boolean getLineNumbersEnabled()
true
if the line numbers are enabled and visible.
public Object[] getTrackingIcons(Point p) throws BadLocationException
p
- The view position.
BadLocationException
- If p
is invalid.public boolean isBookmarkingEnabled()
setBookmarkingEnabled(boolean)
public boolean isIconRowHeaderEnabled()
public void removeTrackingIcon(GutterIconInfo tag)
tag
- A tag for an icon in the gutter, as returned from either
addLineTrackingIcon(int, Icon)
or
addOffsetTrackingIcon(int, Icon)
.removeAllTrackingIcons()
,
addLineTrackingIcon(int, Icon)
,
addOffsetTrackingIcon(int, Icon)
public void removeAllTrackingIcons()
removeTrackingIcon(GutterIconInfo)
,
addOffsetTrackingIcon(int, Icon)
public void setBookmarkIcon(Icon icon)
icon
- The new bookmark icon. If this is null
,
bookmarking is effectively disabled.getBookmarkIcon()
,
isBookmarkingEnabled()
public void setBookmarkingEnabled(boolean enabled)
setBookmarkIcon(Icon)
before bookmarks are
truly enabled.
enabled
- Whether bookmarking is enabled.isBookmarkingEnabled()
,
setBookmarkIcon(Icon)
public void setBorderColor(Color color)
color
- The new color.getBorderColor()
public void setComponentOrientation(ComponentOrientation o)
setComponentOrientation
in class Component
public void setLineNumberColor(Color color)
color
- The color to use when painting line numbers.getLineNumberColor()
public void setLineNumberFont(Font font)
font
- The font to use. This cannot be null
.getLineNumberFont()
public void setLineNumberingStartIndex(int index)
1
. Applications can call this method to change this value
if they are displaying a subset of lines in a file, for example.
index
- The new index.getLineNumberingStartIndex()
public boolean toggleBookmark(int line) throws BadLocationException
line
- The line.
BadLocationException
- If line
is an invalid line
number in the text area.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |