Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Fonts in Java

  • 22-03-2004 11:43PM
    #1
    Closed Accounts Posts: 999 ✭✭✭


    Hi guys,

    I'm trying to set the font of a JEditorPane and I'm having terrible trouble. As far as I can tell from java.sun.com I have things written correctly but it still doesn't,
    [PHP]
    Font memFont = new Font(Monospaced, PLAIN, 10);
    memoryPane.setFont(memFont);
    [/PHP] I tried using Fixedsys in the name field but it didn't work either and it doesn't seem to recognise PLAIN as a field constant from java.awt.Font
    Basicaly I just want everything in the pane to be in a monospaced type font.
    A possible problem was that there should be a fonts directory in lib/ but I don't seem to have one. Though java.sun says it should look where the fonts are installed on the system.
    reference:
    http://java.sun.com/j2se/1.4.2/docs/guide/intl/font.html

    My compiler errors,
    .\GUI.java:169: cannot resolve symbol
    symbol : variable Monospaced
    location: class GUI
    Font memFont = new Font(Monospaced, PLAIN, 10);
    ^
    .\GUI.java:169: cannot resolve symbol
    symbol : variable PLAIN
    location: class GUI
    Font memFont = new Font(Monospaced, PLAIN, 10);

    Has anyone any ideas on how this works?


Comments

Advertisement