I have a JTextPane with some styled text in it and i am trying to scale them.
What i mean is that assuming that the text inside the JTextPane on startup is a 100% in size. After i click some JButton all the font size of the entire document is reduced to 25%
The thing is that this JTextPane contains alot of text that has different font sizes thus i want each of their respective font sizes of the character to be 25% of its original value.
Does anyone know how to do this?
But is there another way i could achieve the scaling of my styled text in my JTextPane so that it is 25% of its original value by means of subclassing my JTextPane or StyledDocument class and overiding its paint method?
Does anyone know how to do this?
Any help is greatly appreciated
Thank You
Yours Sincerely
Richard West
10-11-2005, 04:49 AM
freesoft_2000
Hi everyone,
I tried to do the scaling of the JtextPane and i seem to get weird results and i really don't know why this is so and maybe someone could weigh in
Here is a full compilable example where you can compile the code and see what i mean
public static void main(String args[])
{
JTextScalar a = new JTextScalar();
a.initialize();
}
}
class JScalableTextPane extends JTextPane
{
/*
public void paintComponent(Graphics g)
{
//This function overrides the JPanel paintComponent function
//and paints the buffered image on the JPEGPanel