View Single Post
Old 12-06-2004, 07:19 AM   #1 (permalink)
freesoft_2000
Code Monkey
 
Join Date: Oct 2004
Posts: 51
freesoft_2000 is on a distinguished road
Question Background Colors

Hi everyone,

I have a weird problem. Currently i am using a jtextpane with the HTMLDocument class as its default document. I am tryin to change the
background colour of the htmldocument but still it does not seem to work. I cannot use the JTextPane's setBackground method as if i do that then i cannot save my document to disk as HTML file thus i am trying to change the background of the jtextpane by using the StyleConstants

Here is what i have been doing

Code:
public void setColor()
{

  Color color1 = ColorChooser1.showDialog(fr, "Color Chooser", Color.white);
      SimpleAttributeSet sas = new SimpleAttributeSet();

 if(color1 != null)
    {
      StyleConstants.setBackground(sas, color1);
      sas.addAttribute(HTML.Attribute.BGCOLOR, color1);
    } 

}
The thing is when i use the above function nothing happens but compiles without any errors. Can anyone please help me out with this problem?

Any help is greatly appreciated

Thank You

Yours Sincerely

Richard West

Last edited by freesoft_2000; 12-06-2004 at 07:51 AM.
freesoft_2000 is offline   Reply With Quote