2

重複の可能性:
Netbeans の jtextpane の行番号

行番号を実装したかったのです。

   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);

しかし、行番号とテキストの間でシフトがあります。行テキストと行番号を 1 行にするにはどうすればよいですか?

4

0 に答える 0