tags:

views:

757

answers:

3

Hello. I have a Java program which prints to a HTML file. Another method reads in this file and prints it to the editor pane.

My problem is that the color orange doesn't work. My code is as follows:

print.println("<html><p><br><font color=\"orange\">");

When I pass this html file into the editor pane all the colors are right. Red, yellow and blue all work but orange doesn't (I have also tried replacing orange with pink etc but no luck). If I change the orange to say blue it works fine. When I open it up as a HTML file on the web the text that I want in orange is in orange and works fine. Help?

Also all the indenting is fine but when it gets near the end, it moves to the right. For Example:

abc 0
bcd 1
vde 1
def 2
...
swe 7      
    dfr 8            
              ..................................................... ert 3

Where ert 3 is the last string that needs to be printed. But it manages to fit all the text in the box.


Edit: Thanks for the help for the first part. Any ideas about the bottom part?

+2  A: 

Orange is not working because its not a default html word

http://www.handleidinghtml.nl/divers/kleuren/schermafdrukken/16kleuren.gif

show the 16 default colors.

Most browsers however support other colors but java only supports HTML 3.2

read all on HTMl and swing in http://java.sun.com/docs/books/tutorial/uiswing/components/html.html

Peter
Thanks for you help.Have you any idea why the indenting get messed up at the end though?It fits all of the strings in the pane but the last string is like this sampleString 4 So that it just fits on screen.
The Special One
+1  A: 

The JEditorPane does not support all the things a modern browser supports. Soon, there will be a JWebPane component, which will provide full WebKit-based HTML support.

Fabian Steeg
A: 

HTML in swing is not up to standard.

Take a look at this component https://xhtmlrenderer.dev.java.net/

l_39217_l