Welcome, Guest. Please login or register.
Did you miss your activation email?
Your Ad Here
Pages: [1]   Go Down
  Print  
Author Topic: Problems with java.awt.FontMetrics  (Read 1068 times)
0 Members and 1 Guest are viewing this topic.
porthos3
Junior Member
*

Reputation: 0
Offline Offline
Posts: 1
Referrals: 0
Activity
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/forum :: A community for software developers
« on: June 06, 2009, 08:49:04 PM »

 Logged
HappyFace
Javaforums.net admin
Senior Member
*

Reputation: 16
Developer @ Engineeringserver network
Online Online
Posts: 2549
Referrals: 12
Activity
12%

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

It doesn't matter how hard you've studied; the material won't be on the exam anyway.
Admin @ www.Engineeringserver.com General Admin @ www.Javaforums.net and it's subsites Forum admin @ www.Javaforums.net Global moderator @ www.Engineeringserver.com network Java / .NET blogger @ www.Engineeringserver.com/blog
XMA performer since 2006 @ http://www.engineeringserver.com/XMA-NaN/ Fan of http://www.retardedweblogger.com
Oh man, too much stuff to do in so little time.

http://www.javaforums.net...lery.html;sa=media;id=170
http://img222.imageshack....707/arkietomatoesmall.jpg
http://img208.imageshack.us/img208/7141/smalli.png
Blizzcon 2k9 Grubby and Cassandra Ng engaged ! <3
Triple D, eerste Denken Dan Doen
lj1987
Member
*

Reputation: 0
Offline Offline
Posts: 16
Referrals: 0
Activity
16%

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/forum :: A community for software developers
   

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