那么我想我必须学习一个小小的HTML
我不会使用HTML.我发现在处理文本窗格时更容易使用属性.在尝试操作HTML时,属性更容易更改.
SimpleAttributeSet green = new SimpleAttributeSet();
StyleConstants.setFontFamily(green, "Courier New Italic");
StyleConstants.setForeground(green, Color.GREEN);
// Add some text
try
{
textPane.getDocument().insertString(0, "green text with Courier font", green);
}
catch(Exception e) {}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
12919 次 |
| 最近记录: |