aspose file tools*
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 Java 8 in Action this week in the Java 8 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,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Retaining Superscript and Subscript fronts in Vector
 
Similar Threads
Word wrap and other issues with JTextPane
Text editor question...
Super and sub string in java to string
Toolbar with color pallette ,different font styles and font sizes
Reading super script in Apache POI