Possible Duplicate:
Line numbers in jtextpane in Netbeans
I wanted to implement linenumbers.
JTextpane linenumbers = new JTextPane("1\n2\n3\n4\n");
// in my project I'm using a function to generate the String with the numbers.
//I think that this is not important for my problem.
JTextPane text = new JTextPane();
JScrollPane scroll = new ScrollPane(text);
scroll.setRowheaderView(linenumbers);
// I'm adding my scroll to my extended JFrame-Class
this.add(scroll, BorderLayout.CENTER);
but I have shift between linenumbers and text. What must I do to have the line text and the linenumbering in one line?