#navi(contents-page-name): No such page: ST

FrontPage

Terai Atsuhiro 2021-12-24 (金) 12:38:13

JTextPane

http://terai.s55.xrea.com/swing/styledlog/screenshot.png

private void append(String str, boolean flg){
  SimpleAttributeSet sas = null;
  if(!flg){
    //sas = new SimpleAttributeSet(jtp.getCharacterAttributes());
    sas = new SimpleAttributeSet();
    StyleConstants.setForeground(sas, Color.RED);
    //StyleConstants.setBold(sas, true);
    //StyleConstants.setFontFamily(sas, "Monospaced");
    //StyleConstants.setFontSize(sas, 32);
    //StyleConstants.setForeground(sas, Color.GREEN);
  }
  try{
    Document doc = jtp.getDocument();
    doc.insertString(doc.getLength(), str+SEPARATOR, sas);
  }catch(BadLocationException e){}
}

StyleConstants