谁知道?从没见过这种情况,显示行号根据鼠标的位置(Point)可算出光标所在的行列,然后将这个值动态地更新一个JLabel的Text就行了。你个文本加一个监听器来处理。

解决方案 »

  1.   

    以下代码实现将(JTextPane)getEditor()中的用"\""括起来的部分显示为红色.SimpleAttributeSet red= new SimpleAttributeSet();
    StyleConstants.setForeground(red, Color.red);
    int start=((JTextPane)getEditor()).getText().indexOf("\"");
    int end=((JTextPane)getEditor()).getText().indexOf("\"",start+1);
    StyledDocument document = (StyledDocument)((JTextPane)getEditor()).getDocument();
    document.setCharacterAttributes(start+1,end-start-1,red,false);
      

  2.   

    显示行号比较好的办法就是JLabel,jFileChooser出的问题肯定和你的程序逻辑有关系,再检查检查:)
      

  3.   

    jfilechooser的问题,是不是addActionListener被调用了N遍?debug一下看看?我就犯过这样的错……