September 04, 2010, 05:41:03 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  Home Help Media Affiliates Login Register  
Pages: [1]   Go Down
  Print  
Author Topic: Problems with java.awt.FontMetrics  (Read 1678 times)
0 Members and 1 Guest are viewing this topic.
porthos3
Junior Member
*

Reputation: 0
Offline Offline
Posts: 1
Referrals: 0

Awards
« on: June 06, 2009, 08:49:04 PM »

Problem: I need to determine the length, in pixels, of a string with a given font.

Purpose: I need to represent two substrings of a word together in a world (using Greenfoot: http://www.greenfoot.org/) as what would appear to be a single string. I would concatenate them, but they need to be different colors.

Attempt: I have looked on the internet, and found that people use java.awt.FontMetrics to solve such a problem. I tried to use it as was shown, and was given the following error.

Error: "java.awt.Graphics is abstract; cannot be instantiated"

I then tried to us var.getFontMetrics(), but I could not figure out what went in place of var.
- I have managed to track down that var is supposed to be of type Graphics, but I am not using Graphics (that I know of).
- I found a method getGraphics() in Component, but ran into the same problem as above.
How do I use FontMetrics? Is there perhaps a simpler solution to this problem?
« Last Edit: June 06, 2009, 09:06:16 PM by porthos3 » Logged
Javaforums.net :: a community about Java software development.
« on: June 06, 2009, 08:49:04 PM »

 Logged
Arkie
Javaforums.net Admin
Senior Member
*

Reputation: 16
Developer @ Javaforums.net
Offline Offline
Posts: 2620
Referrals: 13

WWW Awards
« Reply #1 on: June 07, 2009, 05:08:32 AM »

Can you show us your code so we can look into it?
Logged

Java and .NET developer

To students: It doesn't matter how hard you've studied; the material won't be on the exam anyway.

Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://img222.imageshack....707/arkietomatoesmall.jpg
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
lj1987
Member
*

Reputation: 0
Offline Offline
Posts: 16
Referrals: 0

Awards
« Reply #2 on: January 15, 2010, 05:11:59 AM »


 But a healthy lifestyle goes miles in making the skin look wow young. They should be used as a

supplement only. But, one should wow power leveling not forego healthy eating habits and a disciplined

lifestyle.Exercising is a good way to make the skin breathe. Fresh blood and oxygen come to the rescue and repair the skin, making it look young and

refreshing. Water is another indispensable item for glowing skin. Skin will lose out world of warcraft gold

on the water while internal organs will lap up most of it to help in their function. This will gold in wow

result in a shortage of water in the skin, leading to wrinkles. Water is one of the best anti-aging products.Although it cannot be classified under anti-

aging products, but fasting is another way to healthy living, and thus, glowing skin. It has been medically proven that a decreased food intake results in a

drop in insulin wow gold eu and temperature levels. This in turn, leads to longevity of life. Fasting

forces the body to use its surplus fat, thus burning the calories and making the body lean and healthy.As we age, we are also more susceptible to weakened

muscle control, poorer vision and other things that can contribute to more danger. So, a wow cheap gold

thorough safety check is suggested. I recommend asking another party to perform a check to make sure all potential hazard areas are covered. Some items that

may be necessary for your added safety are grab bars for the shower/bathroom, shower chairs, walkers best wow

gold
and rollators, non-slip rugs; even some simple things such as simply replacing some light bulbs.The other product area refers to items assisting

with providing a sense of security for you and your family. Items such as patient monitors, whole house alarm systems, even an AED unit for those with heart

disease could be useful.Bottom-line, YOU wow gold cheap are your own best advocate


« Last Edit: January 15, 2010, 11:04:33 AM by HappyFace » Logged
Javaforums.net :: a community about Java software development.
   

 Logged
Pages: [1]   Go Up
  Print  
 
Jump to:  

Your Ad Here
Powered by MySQL Powered by PHP Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
TinyPortal v0.9.8 © Bloc
Valid XHTML 1.0! Valid CSS!
Page created in 0.222 seconds with 35 queries.

Google visited last this page Yesterday at 11:23:05 AM