好象有什么字体单独的颜色设置 看看API吧
解决方案 »
- 如何设置事件监视,在JTextField中输入每一个字符都进行判断,如果输入了字母,就不往文本行里输入,反之才允许输入进去
- 如何判当前处于树的哪个节点,并且出发在当前节点产生的动作
- 帮忙解释一下输出结果
- sun.tools.javac.Main 已过时
- 大家帮小弟看一段代码吧!真的不知道哪里有毛病!谢谢
- 有什么办法能把日期类型或者String的数据竖起来显示呢?关于JfreeChart搜索了csdn但是没有答案啊!(解决了给500分阿)
- 怎么会是这样啊,null,""的问题?
- 怎么在javax.swing.Timer中设置执行的时间?在线结分(80)
- 选课了!大家给意见。给分!!
- 超紧急的问题:怎样给一个类的实例改名
- 求教Class.forName()的用法
- 那儿有java 可下
public class Test extends JFrame{
private JTextPane textpane=new JTextPane();
private StyledDocument document=(StyledDocument)textpane.getDocument();
....
public Test(){
......;
setColor();
......;
}
private void setColor(){
SimpleAttributeSet attribute=new SimpleAttributeSet();
StyleConstants.setForeground(attribute,Color.blue);
document.setCharacterAttributes(6,12,attribute,false);
StyleConstants.setForeground(attribute,Color.red);
document.setCharacterAttributes(20,10,attribute,false);
}
......
}