1 Reply Latest reply: May 28, 2012 3:16 PM by EJP RSS

    HTML in JTextPane not working properly

    Murray9654
      Hi I want to draw a table in the JTextPane using html. I have set the content type to "text/html". The following is my code. I am not able to see the table borders and i dont know why? kindly help me in this. Thanks in advance.
      String testSlip="<center><h1><u>Test Slip</u></h1></center><br>" +
                          "<b>Registration Number : </b>"+registerDto.getRegNumber()+"<br>" +
                          "<b>Registration Date : </b>"+registerDto.getDate()+"<br>" +
                          "<b>Due Date : </b>"+registerDto.getDueDate()+"<br>" +
                          "<br><center><table style=' border: 1px solid black;border-collapse: collapse;'>" +
                                              "<tr><td style=' border: 1px solid black;'><b>Sample Name</b></td><td style=' border: 1px solid black;'><b>Tests</b></td><td style=' border: 1px solid black;'><b>Quantity</b></td></tr>" +
                                         "</table></center>" ;
                     JTextPane testSlipTP=new JTextPane();
                testSlipTP.setContentType("text/html");
                testSlipTP.setText(testSlip);
      why is this happening? If i write the same code in a html page and open in browser i am able to see the borders for the table.