Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Fonts in Java

Options
  • 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