Results 1 to 3 of 3
  1. #1
    kader is offline Member
    Join Date
    Sep 2008
    Posts
    3
    Rep Power
    0

    Default How to change The Font

    Can anyone teach me how to change the font? Example i have codes below. How to make change the font and make it bold. I new in java. Thanks

    .......
    h1 =new Label("=============================> English Language Online Quiz <=============================");
    add(h1);
    ......

  2. #2
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    7

    Default

    Java Code:
    JLabel label = new JLabel("My Label");
    java.awt.Font font = new java.awt.Font("Dialog",Font.BOLD,14);
    label.setFont(font);

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Default

    Read more about this on Java doc. First argument of the Font constructor mentioned above is font name, it can be font face name or font family name. That's point most of the time are confusing.

Similar Threads

  1. Replies: 5
    Last Post: 04-25-2009, 09:00 PM
  2. Replies: 0
    Last Post: 06-25-2008, 11:33 AM
  3. how to set font size for a xml value
    By bala_kj in forum Advanced Java
    Replies: 3
    Last Post: 04-01-2008, 12:00 PM
  4. JTable with Font
    By Rama Koti Reddy in forum AWT / Swing
    Replies: 1
    Last Post: 12-12-2007, 06:22 PM
  5. Font question
    By orchid in forum Java 2D
    Replies: 1
    Last Post: 08-01-2007, 03:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •