Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
  • Piet Souris
  • Frits Walraven
  • Carey Brown


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.
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?
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.
Lasagna is spaghetti flvored cake. Just like this tiny ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic