Textbox extends Frame implements ListContainer, ParagraphContainer { public void clearContent() { NodeList nodeList = mTextboxElement.getChildNodes(); int i; for (i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType() == node.TEXT_NODE) mTextboxElement.removeChild(nodeList.item(i)); } } private  Textbox(DrawTextBoxElement textbox); static Textbox getInstanceof(DrawTextBoxElement element); static Textbox newTextbox(TextboxContainer container); void setTextContent(String content); void clearContent(); String getTextContent(); @Override DrawTextBoxElement getOdfElement(); List addList(); List addList(ListDecorator decorator); void clearList(); OdfElement getListContainerElement(); Iterator<List> getListIterator(); boolean removeList(List list); Paragraph addParagraph(String textContent); OdfElement getParagraphContainerElement(); boolean removeParagraph(Paragraph para); Paragraph getParagraphByIndex(int index, boolean isEmptyParagraphSkipped); Paragraph getParagraphByReverseIndex(int reverseIndex, boolean isEmptyParagraphSkipped); Iterator<Paragraph> getParagraphIterator();  }
@Test public void testClearContent() { String content = "welcome to text box"; try { TextDocument textDoc = TextDocument.newTextDocument(); Paragraph p = textDoc.addParagraph("abc"); Textbox box = p.addTextbox(new FrameRectangle(1, 1, 2, 3, SupportedLinearMeasure.IN)); box.setName("box1"); box.addParagraph("test paragraph"); box.clearContent(); box.setTextContent(content); textDoc.save(ResourceUtilities.newTestOutputFile("textsample.odt")); } catch (Exception e) { Logger.getLogger(TextBoxTest.class.getName()).log(Level.SEVERE, null, e); Assert.fail(); } }