@Override
    public void paint(Graphics g) {
        super.paint(g);
        FileTextArea textArea = fileWindow.textArea;
        Font font = textArea.getFont();
        g.setFont(font);
        FontMetrics metrics = getFontMetrics(font);
        Rectangle clip = g.getClipBounds();
        g.setColor(getBackground());
        g.fillRect(clip.x, clip.y, clip.width, clip.height);
        int ascent = metrics.getMaxAscent();
        int h = metrics.getHeight();
        int lineCount = textArea.getLineCount() + 1;
        String dummy = Integer.toString(lineCount);
        if (dummy.length() < 2) {
            dummy = "99";
        }
        int startLine = clip.y / h;
        int endLine = (clip.y + clip.height) / h + 1;
        int width = getWidth();
        if (endLine > lineCount) endLine = lineCount;
        for (int i = startLine; i < endLine; i++) {
            String text;
            int pos = -2;
            try {
                pos = textArea.getLineStartOffset(i);
            } catch (BadLocationException ignored) {
            }
            boolean isBreakPoint = fileWindow.isBreakPoint(i + 1);
            text = Integer.toString(i + 1) + " ";
            int y = i * h;
            g.setColor(Color.blue);
            g.drawString(text, 0, y + ascent);
            int x = width - ascent;
            if (isBreakPoint) {
                g.setColor(new Color(0x80, 0x00, 0x00));
                int dy = y + ascent - 9;
                g.fillOval(x, dy, 9, 9);
                g.drawOval(x, dy, 8, 8);
                g.drawOval(x, dy, 9, 9);
            }
            if (pos == fileWindow.currentPos) {
                Polygon arrow = new Polygon();
                int dx = x;
                y += ascent - 10;
                int dy = y;
                arrow.addPoint(dx, dy + 3);
                arrow.addPoint(dx + 5, dy + 3);
                for (x = dx + 5; x <= dx + 10; x++, y++) {
                    arrow.addPoint(x, y);
                }
                for (x = dx + 9; x >= dx + 5; x--, y++) {
                    arrow.addPoint(x, y);
                }
                arrow.addPoint(dx + 5, dy + 7);
                arrow.addPoint(dx, dy + 7);
                g.setColor(Color.yellow);
                g.fillPolygon(arrow);
                g.setColor(Color.black);
                g.drawPolygon(arrow);
            }
        }
    }
@ Override public void paint ( Graphics g ) { super . paint ( g ) ; FileTextArea textArea = fileWindow . textArea ; Font font = textArea . getFont ( ) ; g . setFont ( font ) ; FontMetrics metrics = getFontMetrics ( font ) ; Rectangle clip = g . getClipBounds ( ) ; g . setColor ( getBackground ( ) ) ; g . fillRect ( clip . x , clip . y , clip . width , clip . height ) ; int ascent = metrics . getMaxAscent ( ) ; int h = metrics . getHeight ( ) ; int lineCount = textArea . getLineCount ( ) + 1 ; String dummy = Integer . toString ( lineCount ) ; if ( dummy . length ( ) < 2 ) { dummy = "99" ; } int startLine = clip . y / h ; int endLine = ( clip . y + clip . height ) / h + 1 ; int width = getWidth ( ) ; if ( endLine > lineCount ) endLine = lineCount ; for ( int i = startLine ; i < endLine ; i ++ ) { String text ; int pos = - 2 ; try { pos = textArea . getLineStartOffset ( i ) ; } catch ( BadLocationException ignored ) { } boolean isBreakPoint = fileWindow . isBreakPoint ( i + 1 ) ; text = Integer . toString ( i + 1 ) + " " ; int y = i * h ; g . setColor ( Color . blue ) ; g . drawString ( text , 0 , y + ascent ) ; int x = width - ascent ; if ( isBreakPoint ) { g . setColor ( new Color ( 0x80 , 0x00 , 0x00 ) ) ; int dy = y + ascent - 9 ; g . fillOval ( x , dy , 9 , 9 ) ; g . drawOval ( x , dy , 8 , 8 ) ; g . drawOval ( x , dy , 9 , 9 ) ; } if ( pos == fileWindow . currentPos ) { Polygon arrow = new Polygon ( ) ; int dx = x ; y += ascent - 10 ; int dy = y ; arrow . addPoint ( dx , dy + 3 ) ; arrow . addPoint ( dx + 5 , dy + 3 ) ; for ( x = dx + 5 ; x <= dx + 10 ; x ++ , y ++ ) { arrow . addPoint ( x , y ) ; } for ( x = dx + 9 ; x >= dx + 5 ; x -- , y ++ ) { arrow . addPoint ( x , y ) ; } arrow . addPoint ( dx + 5 , dy + 7 ) ; arrow . addPoint ( dx , dy + 7 ) ; g . setColor ( Color . yellow ) ; g . fillPolygon ( arrow ) ; g . setColor ( Color . black ) ; g . drawPolygon ( arrow ) ; } } }
Paints the component.