|
|||
|
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, |
|
|
||||
|
||||
|
|
|
|||
|
On Tue, 26 Jul 2005 23:08:22 +0100, Mary Walker wrote:
> ..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> -- Andrew Thompson physci.org 1point1c.org javasaver.com lensescapes.com athompson.info Presented in BC [Brain Control] Where Available |
|
|||
|
On Tue, 26 Jul 2005 22:27:25 GMT, Andrew Thompson wrote:
> On Tue, 26 Jul 2005 23:08:22 +0100, Mary Walker wrote: > >> ..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)> Or to put that another way.. <http://www.javasaver.com/sb/01/index.jsp?saver=humanrights> (requires 1.5 ..probably) ...read the page carefully. ;-) -- Andrew Thompson physci.org 1point1c.org javasaver.com lensescapes.com athompson.info Too Hot For Radio |
|
|||
|
Mary Walker wrote:
> 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 -- The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/...g/java/gui/faq http://www.uni-giessen.de/faq/archiv....java.gui.faq/ |
|
|||
|
"Thomas Weidenfeller" <nobody@ericsson.invalid> wrote in message news:dc7f91$h57$1@news.al.sw.ericsson.se... > Mary Walker wrote: >> 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 > -- > The comp.lang.java.gui FAQ: > ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/...g/java/gui/faq > http://www.uni-giessen.de/faq/archiv....java.gui.faq/ Thanks. That worked fine, regards, Mary |
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Another Sudoku Solver: mostly datastep and macro(Long) | John Gerlach | Newsgroup comp.soft-sys.sas | 0 | 05-12-2006 04:40 PM |
| Another Sudoku Solver: mostly datastep and macro(Long) | T J | Newsgroup comp.soft-sys.sas | 0 | 05-12-2006 04:18 PM |
| Re: Controlling font size when going from SAS Graph to MS Word | Jonas Bilenas | Newsgroup comp.soft-sys.sas | 0 | 08-05-2005 02:13 PM |
| Controlling font size when going from SAS Graph to MS Word | BruceBrad@iname.com | Newsgroup comp.soft-sys.sas | 0 | 08-04-2005 03:46 AM |
| font size in GIF output | Arjen Raateland | Newsgroup comp.soft-sys.sas | 1 | 06-29-2005 01:20 PM |