HTMLEditorKit and Custom tags in the JEditorPane

后端 未结 2 1318
广开言路
广开言路 2021-01-27 09:33

I use the instructions to add my own tag http://java-sl.com/custom_tag_html_kit.html

class MyParserDelegator extends ParserDelegator {
public MyParserDelegator()         


        
2条回答
  •  有刺的猬
    2021-01-27 10:04

    It works for me using the following (jdk 1.7):

    Field f = javax.swing.text.html.parser.ParserDelegator.class.getDeclaredField("DTD_KEY");
    

    The only change is the key: "DTD_KEY" upper case!!

    I found the key "DTD_KEY" using

    Field[] flds = javax.swing.text.html.parser.ParserDelegator.class.getDeclaredFields();
    for (Field f: flds)  
    {
           System.err.println(f.getName());
    }
    

提交回复
热议问题