AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Aiuto per FontMetrics

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
Arfaiten
Guest





PostPosted: Sun May 20, 2007 7:14 am    Post subject: Aiuto per FontMetrics Reply with quote



Ho necessita' di recuperare un FontMetrics per determinare la lunghezza in
pixel di una stringa da mostrare sullo schermo, ma non dovendo fare questa
operazione all'interno di una funzione di paint non possiedo il Graphics
Object del componente destinatario.
Utilizzando Tolkit.getDefaultTolkit.getFontMetrics(font) mi viene segnalato
che e' deprecated, ma la funzione alternativa che mi viene segnalata
(Font.getLineMetrics) non sembra permettere la funzione che voglio.
Come fare? Lascio la funzione deprecated?

Ciao,
Roberto
Back to top
Giambo
Guest





PostPosted: Sun May 20, 2007 2:25 pm    Post subject: Re: Aiuto per FontMetrics Reply with quote



Arfaiten wrote:
Quote:
Ho necessita' di recuperare un FontMetrics per determinare la lunghezza in
pixel di una stringa da mostrare sullo schermo, ma non dovendo fare questa
operazione all'interno di una funzione di paint non possiedo il Graphics
Object del componente destinatario.

Se hai un oggetto di tipo java.awt.Component, credo tu possa usare il metodo
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#getFontMetrics()
Back to top
Arfaiten
Guest





PostPosted: Sun May 20, 2007 2:49 pm    Post subject: Re: Aiuto per FontMetrics Reply with quote



Quote:
Se hai un oggetto di tipo java.awt.Component, credo tu possa usare il
metodo
http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#getFontMetrics()

Grazie mille, adesso funziona... e pensare che ci avevo anche guardato...
Classico esempio di "cercava l'asino e c'era sopra"...

Grazie ancora,
Roberto
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.