/** * Calculates the last line number index painted in this component. * * @return The last line number index painted in this component. */ private int calculateLastVisibleLineNumber() { int lastLine = 0; if (textArea!=null) { lastLine = textArea.getLineCount()+getLineNumberingStartIndex()-1; } return lastLine; }
/** * Changes the width of the cells in the JList so you can see every digit * of each. */ void updateCellWidths() { int oldCellWidth = cellWidth; cellWidth = getRhsBorderWidth(); // Adjust the amount of space the line numbers take up, if necessary. if (textArea!=null) { Font font = getFont(); if (font!=null) { FontMetrics fontMetrics = getFontMetrics(font); int count = 0; int lineCount = textArea.getLineCount() + getLineNumberingStartIndex() - 1; do { lineCount = lineCount/10; count++; } while (lineCount >= 10); cellWidth += fontMetrics.charWidth('9')*(count+1) + 3; } } if (cellWidth!=oldCellWidth) { // Always true revalidate(); } }
/** * Returns the starting line's line number. The default value is * <code>1</code>. * * @return The index * @see #setLineNumberingStartIndex(int) */ public int getLineNumberingStartIndex() { return lineNumberList.getLineNumberingStartIndex(); }
/** * Returns the starting line's line number. The default value is * <code>1</code>. * * @return The index * @see #setLineNumberingStartIndex(int) */ public int getLineNumberingStartIndex() { return lineNumberList.getLineNumberingStartIndex(); }
int line = topLine + 1; while (y<visibleRect.y+visibleRect.height+ascent && line<=textArea.getLineCount()) { String number = Integer.toString(line + getLineNumberingStartIndex() - 1); int width = metrics.stringWidth(number); g.drawString(number, rhs-width,y); int line = topLine + 1; while (y<visibleRect.y+visibleRect.height && line<textArea.getLineCount()) { String number = Integer.toString(line + getLineNumberingStartIndex() - 1); g.drawString(number, rhsBorderWidth, y); y += cellHeight;
int index = (topLine+1) + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); if (ltr) {
/** * Calculates the last line number index painted in this component. * * @return The last line number index painted in this component. */ private int calculateLastVisibleLineNumber() { int lastLine = 0; if (textArea!=null) { lastLine = textArea.getLineCount()+getLineNumberingStartIndex()-1; } return lastLine; }
/** * Changes the width of the cells in the JList so you can see every digit * of each. */ void updateCellWidths() { int oldCellWidth = cellWidth; cellWidth = getRhsBorderWidth(); // Adjust the amount of space the line numbers take up, if necessary. if (textArea!=null) { Font font = getFont(); if (font!=null) { FontMetrics fontMetrics = getFontMetrics(font); int count = 0; int lineCount = textArea.getLineCount() + getLineNumberingStartIndex() - 1; do { lineCount = lineCount/10; count++; } while (lineCount >= 10); cellWidth += fontMetrics.charWidth('9')*(count+1) + 3; } } if (cellWidth!=oldCellWidth) { // Always true revalidate(); } }
int rhs = getWidth() - RHS_BORDER_WIDTH; for (int i=topLine+1; i<=bottomLine; i++) { int index = i + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); int width = metrics.stringWidth(number); int index = i + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); g.drawString(number, RHS_BORDER_WIDTH, y);
int rhs = getWidth() - RHS_BORDER_WIDTH; for (int i=topLine+1; i<=bottomLine; i++) { int index = i + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); int width = metrics.stringWidth(number); int index = i + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); g.drawString(number, RHS_BORDER_WIDTH, y);
int index = (topLine+1) + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); if (ltr) {
int index = (topLine+1) + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); if (ltr) {
int line = topLine + 1; while (y<visibleRect.y+visibleRect.height+ascent && line<=textArea.getLineCount()) { String number = Integer.toString(line + getLineNumberingStartIndex() - 1); int width = metrics.stringWidth(number); g.drawString(number, rhs-width,y); int line = topLine + 1; while (y<visibleRect.y+visibleRect.height && line<textArea.getLineCount()) { String number = Integer.toString(line + getLineNumberingStartIndex() - 1); g.drawString(number, rhsBorderWidth, y); y += cellHeight;
int index = (topLine+1) + getLineNumberingStartIndex() - 1; String number = Integer.toString(index); if (ltr) {