org.das2.jythoncompletion.Utilities

Utilities for the editor.

Utilities( )


getLineNumberForOffset

getLineNumberForOffset( javax.swing.JTextArea a, int offset ) → int

return the line number that contains the offset.

Parameters

a - a JTextArea
offset - an int

Returns:

the line number, zero is the first line.

See Also:

JTextArea#getLineOfOffset(int)


[search for examples] [view on GitHub] [view on old javadoc] [view source]

getLineNumberForOffset( javax.swing.text.JTextComponent comp, int offset ) → int

getLinePosition

getLinePosition( javax.swing.JTextPane editor, int carotPos ) → int

return the index of the start and end of the selection, rounded out to complete lines.

Parameters

editor - the editor
carotPos - the carot position within the editor.

Returns:

[start,len] where start is the index of the first character and len is the number of characters.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getOffsetForLineNumber

getOffsetForLineNumber( String text, int line ) → int

given a line number, where zero is the first line, what is the offset?

Parameters

text - the text document
line - an int

Returns:

the character offset of the line.

[search for examples] [view on GitHub] [view on old javadoc] [view source]


getRowEnd

getRowEnd( javax.swing.text.JTextComponent editor, int pos ) → int

return the offset of the last character of the line.

Parameters

editor - a JTextComponent
pos - an int

Returns:

an int

[search for examples] [view on GitHub] [view on old javadoc] [view source]

getRowEnd( javax.swing.JTextArea a, int offset ) → int

getRowStart

getRowStart( javax.swing.text.JTextComponent editor, int pos ) → int

return the offset of the first character of the line. See javax.swing.text.Utilities, it's the same thing.

Parameters

editor - a JTextComponent
pos - an int

Returns:

an int

[search for examples] [view on GitHub] [view on old javadoc] [view source]

getRowStart( javax.swing.JTextArea a, int offset ) → int

getWordAt

getWordAt( javax.swing.JTextPane logTextArea, int caret ) → String

look for adjacent whitespace to identify the word at the location.

Parameters

logTextArea - a JTextPane
caret - an int

Returns:

a String

[search for examples] [view on GitHub] [view on old javadoc] [view source]