Avatar billede fredand Forsker
02. maj 2002 - 14:25 Der er 3 kommentarer og
2 løsninger

Change Font

Hello!

I need to change font in a JTextPane, and I would like to change it to the same font as they have in TextPad. That Font is Curier New or Curier. But I seems that only one of these fonts is availble for Java.

I think that the font in Java is Curier.Normal and the one in TextPad is Curier New.Regular.

Since the font is availble in TextPad it must be availble on my machine, so I guess that it should be possible to import to my Java-app in some how.

So if any one has I clue for this please let me know.

Best regards.

Fredrik Andersson
Avatar billede Slater Ekspert
02. maj 2002 - 14:29 #1
I'm not really into Java, just Microsoft's version: J++, and I've never had your problem, but you should be able to create a new Font object and enter the name of the font (which is "Courier New" by the way, not "Curier New") and then set the Font of the Pane to that... dunno.
Avatar billede lyhr007 Nybegynder
02. maj 2002 - 14:29 #2
Avatar billede lyhr007 Nybegynder
02. maj 2002 - 14:30 #3
Avatar billede yeager Nybegynder
02. maj 2002 - 15:05 #4
Being very new to java I dare to post this anyway.
Why not make a selection based on what font is available...
see http://java.sun.com/docs/books/tutorial/2d/textandfonts/fontselection.html

Hope this will help you.
MvH
Avatar billede fredand Forsker
06. maj 2002 - 11:36 #5
Hello!

Thanks for your help!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester