This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am working on a project in which I am required to store the text written in a JTextPane to an XML File. During this I take the data one by one and add the various entries in the TextPane to a vector and then finally put the content of vector in the XML File. The Problem that I am facing is that when the user enters a superscript or a subscript in the TextPane the vector takes it as a normal text so that when I try and print the contents of vector I see normal text and not Superscript and subscript. Can someone help me in solving this problem where I should be able to take the text in the way it is entered all the way to the XMl File via the Vector. We are allowing the addition of SuperScript or subscript through the following code: //I GET THIS FROM A FORUM AND IT WORKS FINE. Font f = new Font("Arial",Font.PLAIN,15); MutableAttributeSet mas = new SimpleAttributeSet(); StyleConstants.setFontFamily(mas,f.getFamily()); StyleConstants.setFontSize(mas,f.getSize()); StyleConstants.setSuperscript(mas,false); StyleConstants.setSubscript(mas,true); presentTextPane.setCharacterAttributes(mas,false);