Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JTextPane font size problem

Murray9654May 30 2012 — edited May 31 2012
I have a JTextPane. i have set the content type to 'html'. but the problem is i am not able to reduce the size of the string that i obtain from my beans. The following is my code
JTextPane ackTP=new JTextPane();		
		ackTP.setContentType("text/html");
		ackTP.setText(buildTestSlip(registerDto));

private String buildTestSlip(TestRegisterDto registerDto){
		
		String imgPath=Resources.class.getResource("lucidfull.jpg").toString();
		StringBuffer sb=new StringBuffer();
		String testSlip="<table>" +
							"<tr><td width='700' align='right'><img src='"+imgPath+"'/></td></tr>" +
						"</table><br>" +
				"<center><h3><u>Acknowledgement</u></h3></center><br>"+
				"<table border='0'><tr><td width=350><b><font size='2'>Registration Number : </b>"+registerDto.getRegNumber()+"</font></td><td width='350' align='right'><b>Registration Date : </b>"+registerDto.getDate()+"</td></tr></table><br>";
   return sb.toString();
}
Inside the table i have declared font tag for "registration number" so the size got reduced for that but i have taken the value that is registration number
from the registerDto bean. this value is being displayed in a fixed size. this is not getting reduced.
kindly help me in this. how to reduce this size?

Edited by: sabre150 on May 30, 2012 9:06 AM

Moderator action : removed surplus {code } tags from simple text.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 28 2012
Added on May 30 2012
3 comments
286 views