Java写的文本显示下划线如何实现 本人的毕设是文本错误的自动修改,想用Java显示,但是对Java写客户端这块不太熟悉。先在想用Java实现在出错的文本下面显示波浪线来提示错误,就像WORD里面的语法错误提示一样,但是不知道该怎么实现,请各位大虾帮帮忙。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SimpleAttributeSet sas = new SimpleAttributeSet(); StyleConstants.setUnderline(sas, underline); setCharacterAttributes(editor, sas, false); 在错误处加下划线JTextPane textPane = ...;StyledDocument document = (StyledDocument) textPane.getDocument();SimpleAttributeSet attribSet = new SimpleAttributeSet();StyleConstants.setForeground(attribSet, Color.RED);StyleConstants.setUnderline(attribSet,true);// 某个错误的位置和长度int begin = ...;int offset = ...;document.setCharacterAttributes(begin,offset,attribSet,false); 菜鸟求助 为什么同样的语句,java 比 c++ 快了10几倍,附有代码 如何用socket做一个c/s之间稳定传输object的底层?? 引入org.jgraph的问题 大家一起研究JAVA 请加QQ群17195117 各位大哥好,我想下载jbuilder9.0,可是不知道哪里下载,有免费的吗?救救小弟, 用JTree显示数据表中的数据,各节点显示不是字符串,形式为AreaNode@197bb7 jbuilder下标识种子(增量为1)主键updata问题 字符串操作 java se怎么整合JdbcTemplate 某国内知名大学毕业的博士写的JAVA代码 SQLServer2000连接不上
StyleConstants.setUnderline(sas, underline);
setCharacterAttributes(editor, sas, false);
StyledDocument document = (StyledDocument) textPane.getDocument();SimpleAttributeSet attribSet = new SimpleAttributeSet();
StyleConstants.setForeground(attribSet, Color.RED);
StyleConstants.setUnderline(attribSet,true);// 某个错误的位置和长度
int begin = ...;
int offset = ...;document.setCharacterAttributes(begin,offset,attribSet,false);