<h2>org.das2.jythoncompletion.Utilities</h2><p>Utilities for the editor.</p> <h2>Utilities( )</h2> <p></p> <hr> <a name="getLineNumberForOffset"></a> <h2>getLineNumberForOffset</h2> getLineNumberForOffset( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/JTextArea.html'>javax.swing.JTextArea</a> a, int offset ) → int <p>return the line number that contains the offset.</p> <h3>Parameters</h3> a - a JTextArea <br> offset - an int <h3>Returns:</h3> the line number, zero is the first line. <h3>See Also:</h3> <a href='null'>JTextArea#getLineOfOffset(int)</a> <br> <br><br> <a href="https://github.com/autoplot/dev/search?q=getLineNumberForOffset&unscoped_q=getLineNumberForOffset">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/jythoncompletion/Utilities.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/jythoncompletion/Utilities.html#getLineNumberForOffset">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCore/src/org/das2/jythoncompletion/Utilities.java">[view source]</a> <br> <br> getLineNumberForOffset( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/text/JTextComponent.html'>javax.swing.text.JTextComponent</a> comp, int offset ) → int<br> <hr> <a name="getLinePosition"></a> <h2>getLinePosition</h2> getLinePosition( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/JTextPane.html'>javax.swing.JTextPane</a> editor, int carotPos ) → int[] <p>return the index of the start and end of the selection, rounded out to complete lines.</p> <h3>Parameters</h3> editor - the editor <br> carotPos - the carot position within the editor. <h3>Returns:</h3> [start,len] where start is the index of the first character and len is the number of characters. <br><br> <a href="https://github.com/autoplot/dev/search?q=getLinePosition&unscoped_q=getLinePosition">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/jythoncompletion/Utilities.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/jythoncompletion/Utilities.html#getLinePosition">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCore/src/org/das2/jythoncompletion/Utilities.java">[view source]</a> <br> <br> <hr> <a name="getOffsetForLineNumber"></a> <h2>getOffsetForLineNumber</h2> getOffsetForLineNumber( <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> text, int line ) → int <p>given a line number, where zero is the first line, what is the offset?</p> <h3>Parameters</h3> text - the text document <br> line - an int <h3>Returns:</h3> the character offset of the line. <br><br> <a href="https://github.com/autoplot/dev/search?q=getOffsetForLineNumber&unscoped_q=getOffsetForLineNumber">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/jythoncompletion/Utilities.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/jythoncompletion/Utilities.html#getOffsetForLineNumber">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCore/src/org/das2/jythoncompletion/Utilities.java">[view source]</a> <br> <br> <hr> <a name="getRowEnd"></a> <h2>getRowEnd</h2> getRowEnd( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/text/JTextComponent.html'>javax.swing.text.JTextComponent</a> editor, int pos ) → int <p>return the offset of the last character of the line.</p> <h3>Parameters</h3> editor - a JTextComponent <br> pos - an int <h3>Returns:</h3> an int <br><br> <a href="https://github.com/autoplot/dev/search?q=getRowEnd&unscoped_q=getRowEnd">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/jythoncompletion/Utilities.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/jythoncompletion/Utilities.html#getRowEnd">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCore/src/org/das2/jythoncompletion/Utilities.java">[view source]</a> <br> <br> getRowEnd( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/JTextArea.html'>javax.swing.JTextArea</a> a, int offset ) → int<br> <hr> <a name="getRowStart"></a> <h2>getRowStart</h2> getRowStart( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/text/JTextComponent.html'>javax.swing.text.JTextComponent</a> editor, int pos ) → int <p>return the offset of the first character of the line. See javax.swing.text.Utilities, it's the same thing.</p> <h3>Parameters</h3> editor - a JTextComponent <br> pos - an int <h3>Returns:</h3> an int <br><br> <a href="https://github.com/autoplot/dev/search?q=getRowStart&unscoped_q=getRowStart">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/jythoncompletion/Utilities.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/jythoncompletion/Utilities.html#getRowStart">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCore/src/org/das2/jythoncompletion/Utilities.java">[view source]</a> <br> <br> getRowStart( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/JTextArea.html'>javax.swing.JTextArea</a> a, int offset ) → int<br> <hr> <a name="getWordAt"></a> <h2>getWordAt</h2> getWordAt( <a href='http://www-pw.physics.uiowa.edu/~jbf/autoplot/doc/javax/swing/JTextPane.html'>javax.swing.JTextPane</a> logTextArea, int caret ) → <a href='https://docs.oracle.com/javase/8/docs/api/java/lang/String.html'>String</a> <p>look for adjacent whitespace to identify the word at the location.</p> <h3>Parameters</h3> logTextArea - a JTextPane <br> caret - an int <h3>Returns:</h3> a String <br><br> <a href="https://github.com/autoplot/dev/search?q=getWordAt&unscoped_q=getWordAt">[search for examples]</a> <a href="https://github.com/autoplot/documentation/tree/master/javadoc/org/das2/jythoncompletion/Utilities.md">[view on GitHub]</a> <a href="http://www-pw.physics.uiowa.edu/~jbf/autoplot/javadoc2018/org/das2/jythoncompletion/Utilities.html#getWordAt">[view on old javadoc]</a> <a href="https://saturn.physics.uiowa.edu/svn/das2/dasCore/community/autoplot2011/trunk/dasCore/src/org/das2/jythoncompletion/Utilities.java">[view source]</a> <br> <br>