试图在文本窗格中获取每行的起点和终点:文本窗格包含(注意目标是每行的结尾,不包括空白行):
(blank space line) MVESMKKVAGMDVELTVEERN000TAQEGDHGSHVYTKQKEENKGGEDKLKMIREYRQMVETELKLICCDILDVLDKHDDDDDKVFYYKMKGDYHRYLAEFATGNDRKEAAENSLVAYKAASDIAMTELPPTHPIRLGLALNFSVFYYEILNSPDRACRLAKAAFDDAIAELDTLSEESYKDS00000VQVGQQRSDMQGDGKKKAAAEEQNKEALQDVEDENQtarget MVESMKKVAGMDVELTVEERN000TAQEGDHGSHVYTKQKEENKGGEDKLKMIREYRQMVETELKLICCDILDVLDKHDDDDDDVFYYKMKGDYHRYLAEFATGNDRKEAAENSLVAYKAASDIAMTELPPTHPIRLGLALNFSVFYYEILNSPDRACRLAKAAFDDAIAELDTLSEESYKDS00000VQVGQQRSDMQGDGKKKAAAEEQNKEALQDVEDENQtarget MVESMKKVAGMDVELTVEERN000TAQEGDHGSHVYTKQKEENKGGEDKLKMIREYRQMVETELKLICCDILDVLDKHDDDDDDDFYYKMKGDYHRYLAEFATGNDRKEAAENSLVAYKAASDIAMTELPPTHPIRLGLALNFSVFYYEILNSPDRACRLAKAAFDDAIAELDTLSEESYKDS00000VQVGQQRSDMQGDGKKKDDDDDDDEEQNKEALQDVEDENQtarget
//这就是我所拥有的
Element root = jTextPane1.getDocument().getDefaultRootElement();
Element one = root.getElement(0);
while (one !=null){
int one1 = one.getStartOffset();
int two1 = one.getEndOffset();
System.out.println(one1);
System.out.println(two1);
one = root.getElement(two1);
}
这就是我得到的(第一个和第二个元素)然后挂起:0 1 1 232