hello thanks for your reply I am using swing libraries and there i am able to create a leaf or a branch of a document but the leafelement doesnt seem to get added to the default root .
public class MyDoc extends DefaultStyledDocument {
protected void insertUpdate(AbstractDocument.DefaultDocumentEvent e,
AttributeSet attr){
Element root = getDefaultRootElement();
Element branchroot = new BranchElement(root, null);
branchroot = createBranchElement(root,null);
Element leafElement = new LeafElement(branchroot, null, 0,0);
leafElement = createLeafElement(branchroot,null,"p");
}
public Element createBranchElement(Element parent,AttributeSet a)
{
return super.createBranchElement(parent, a);
}
protected Element createLeafElement(Element parent,AttributeSet a, String arg) throws BadLocationException
{
return super.createLeafElement(parent, null, startOffset(arg),startOffset(arg)+5);
//complete code createleaf not written
}
}