Hi,
I would like to draw a string to a panel using the Graphics object (g) i.e
g.drawString("Test",150,150); but I would like to be able to wrap a long
string around the width of the panel (a bit like a word processor would).
For this, I need a fix sized font where all the characters are the same
width. However, the font set seems limitted and I have had no joy getting
access to a fix sized font.
Any ideas?
Regards,
Mary,
Andrew Thompson - 26 Jul 2005 23:27 GMT
> ..However, the font set seems limitted and I have had no joy getting
> access to a fix sized font.
>
> Any ideas?
Did you try each of the 'names' listed in this constructor?
<http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Font.html#Font(java.lang.String
,%20int,%20int)>
If that is not ..giving you joy, you might try
describing your code more precisely, vis.
<http://www.physci.org/codes/sscce.jsp>

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Presented in BC [Brain Control] Where Available
Andrew Thompson - 26 Jul 2005 23:31 GMT
>> ..However, the font set seems limitted and I have had no joy getting
>> access to a fix sized font.
[quoted text clipped - 3 lines]
> Did you try each of the 'names' listed in this constructor?
> <http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Font.html#Font(java.lang.String
,%20int,%20int)>
Or to put that another way..
<http://www.javasaver.com/sb/01/index.jsp?saver=humanrights>
(requires 1.5 ..probably)
..read the page carefully. ;-)

Signature
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
Too Hot For Radio
Thomas Weidenfeller - 27 Jul 2005 09:05 GMT
> I would like to draw a string to a panel using the Graphics object (g) i.e
> g.drawString("Test",150,150); but I would like to be able to wrap a long
> string around the width of the panel (a bit like a word processor would).
> For this, I need a fix sized font where all the characters are the same
> width. However, the font set seems limitted and I have had no joy getting
> access to a fix sized font.
new Font("Monospaced", PLAIN, 10)
Please see the API documentation for details.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/
Mary Walker - 28 Jul 2005 16:42 GMT
>> I would like to draw a string to a panel using the Graphics object (g)
>> i.e g.drawString("Test",150,150); but I would like to be able to wrap a
[quoted text clipped - 8 lines]
>
> /Thomas
Thanks. That worked fine,
regards,
Mary