This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Java in General and the fly likes Retaining Superscript and Subscript fronts in Vector Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Retaining Superscript and Subscript fronts in Vector" Watch "Retaining Superscript and Subscript fronts in Vector" New topic
Author

Retaining Superscript and Subscript fronts in Vector

Con Karega
Greenhorn

Joined: Sep 26, 2002
Posts: 8
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);

Thanks,
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Retaining Superscript and Subscript fronts in Vector