多谢帮忙!

解决方案 »

  1.   

    JTextArea area = new JTextArea();
    StyleConstants.setUnderline(area.getCharacterAttributes(),true); 
      

  2.   

    请问getCharacterAttributes()方法在哪个类中?
    StyleConstants这个类在哪里?
      

  3.   

    javax.swing.text 
    Class StyleConstants
    java.lang.Object
      javax.swing.text.StyleConstants
      

  4.   

    好像没有这个方法阿? getCharacterAttributes()
      

  5.   

    这个方法在JTextArea中不起作用,换成 JTextPane才行