JTextPane HTML renderer wrong?
问题 I have a JTextPane and want to create a div within it, with exactly the height of the JTextPane. The div should be always the height of the JTextPane. public class Test { JTextPane edit=new JTextPane(); public Test() { JFrame frame=new JFrame("Center text vertically"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(edit); String text = "<html><div style=\"height: 0px; border: 1px solid black;\">here is some text</div></html>"; edit.setEditorKit(new