JLabel l = new JLabel("<html>Hello World</html>");
f.getContentPane().add(l);
f.pack();
f.setVisible(true);
l.setSize(100, 30);
AccessibleText at = (AccessibleText) l.getAccessibleContext();
// The HTML renderer is stored as client property.
View v = (View) l.getClientProperty(BasicHTML.propertyKey);
Rectangle r = getTextRectangle(l);
Rectangle expected = null;
try
{
expected = v.modelToView(2, r, Position.Bias.Forward).getBounds();
}
catch (BadLocationException ex)
{
h.debug(ex);
h.fail("Unexpected BadLocationException");
}
Rectangle b = at.getCharacterBounds(2);
h.check(b, expected);
f.dispose();
}