• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drawString();

 
Sean Casey
Ranch Hand
Posts: 625
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet that queries a database and then returns a String and the applet draws that string. My only problem is how do I set up the applet so the string is only displayed within the applet? Right now have of it is, and the other have extends beyond the applet? I know this maybe simple but I've tried a few things and I am stumped.
Thanks.
 
Sharada Kumaran
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if I understood your problem correctly. I had a similar requirement, where I had to display a whole paragraph.
You could substring the database string, and extract say, 50 characters into an array. and display each array element in a separate line. So, each line would display 50 characters.
Or if your string is shorter, you could change the font.
I hope this solves your problem?
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Sean,
I am not really sure about your problem. But you need to work with the positioning of the string and the string width. To get a strings width you should use the FontMetrics.stringWidth method.
Regards,
Manfred.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic