This should fix HTML rendering for components that support it.

2006-09-01  Roman Kennke  <[EMAIL PROTECTED]>

        PR 28922
        * javax/swing/plaf/basic/BasicHTML.java
        (HTMLRootView.getAttributes): Overridden to return null.
        (HTMLRootView.getElement): Overridden to return the view's
        element.

/Roman
Index: javax/swing/plaf/basic/BasicHTML.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicHTML.java,v
retrieving revision 1.5
diff -u -1 -2 -r1.5 BasicHTML.java
--- javax/swing/plaf/basic/BasicHTML.java	13 Aug 2006 21:33:59 -0000	1.5
+++ javax/swing/plaf/basic/BasicHTML.java	1 Sep 2006 09:33:12 -0000
@@ -39,24 +39,25 @@
 package javax.swing.plaf.basic;
 
 import java.awt.Container;
 import java.awt.Graphics;
 import java.awt.Rectangle;
 import java.awt.Shape;
 import java.io.IOException;
 import java.io.StringReader;
 
 import javax.swing.JComponent;
 import javax.swing.SwingConstants;
 import javax.swing.event.DocumentEvent;
+import javax.swing.text.AttributeSet;
 import javax.swing.text.BadLocationException;
 import javax.swing.text.Document;
 import javax.swing.text.EditorKit;
 import javax.swing.text.Element;
 import javax.swing.text.Position;
 import javax.swing.text.View;
 import javax.swing.text.ViewFactory;
 import javax.swing.text.html.HTMLDocument;
 import javax.swing.text.html.HTMLEditorKit;
 
 /**
  * Provides support for HTML rendering to [EMAIL PROTECTED] javax.swing.plaf.ComponentUI}
@@ -346,24 +347,40 @@
       return 0;
     }
 
     public int getEndOffset()
     {
       return getDocument().getLength();
     }
 
     public Document getDocument()
     {
       return document;
     }
+
+    /**
+     * Overridden to return null, as a RootView has no attributes on its own.
+     */
+    public AttributeSet getAttributes()
+    {
+      return null;
+    }
+
+    /**
+     * Overridden to provide an element for the view.
+     */
+    public Element getElement()
+    {
+      return view.getElement();
+    }
   }
 
   /**
    * The key that is used to store a HTML view in a JComponent's client
    * properties.
    */
   public static final String propertyKey = "html";
 
   /**
    * The key that is used to store the document base in a JComponent's client
    * properties. The document base is used to resolve relative references
    * in HTML.

Reply via email to