Results 1 to 6 of 6
  1. #1
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default Font type not getting applied

    hi friends
    am buiding java awt proj n to change the button font type i use following code
    Java Code:
    Button bt= new Button("Exit");
    bt.setBounds(250,250,50,30);
    bt.setBackground(Color.gray);
    bt.setForeground(Color.white);
    bt.setFont(new Font("Old English Text MT",Font.PLAIN,20);
    but after execution only the size n Plain is getting applied but whr as the font type is not getting applied..
    kindly help me..
    plzzzzzzzzzzz

  2. #2
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,568
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by afreaz View Post
    hi friends
    am buiding java awt proj n to change the button font type i use following code
    Java Code:
    Button bt= new Button("Exit");
    bt.setBounds(250,250,50,30);
    bt.setBackground(Color.gray);
    bt.setForeground(Color.white);
    bt.setFont(new Font("Old English Text MT",Font.PLAIN,20);
    but after execution only the size n Plain is getting applied but whr as the font type is not getting applied..
    kindly help me..
    plzzzzzzzzzzz
    Try types Font.BOLD or Font.ITALICS or both and try if you see any difference. btw, I don't have that font and the type works with all the other fonts installed on my machine.

    kind regards,

    Jos

  3. #3
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    hi josh..
    thank for this..
    but even after trying this am not getting the font type..
    even if i put any font is not accepting it..

  4. #4
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    ya josh am using jdk1.6 to execute my programs does that matter in any ways

    thanks n regards

    Arsh

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,568
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by afreaz View Post
    ya josh am using jdk1.6 to execute my programs does that matter in any ways

    thanks n regards

    Arsh
    As I wrote before, I don't know that font; experiment a bit with it, i.e. set the font and print out the values of isBold(), isItalic(), isTransformed() etc. Maybe that font can only be rendered plain. Also try other fonts and see what happens.

    kind regards,

    Jos

  6. #6
    ziaf is offline Member
    Join Date
    Mar 2010
    Posts
    8
    Rep Power
    0

    Default

    Hi afreaz
    Actually in java u can categorize fonts to 2 type
    1 Physical Font( Normal Fonts available in your machine)
    2 Logical Fonts (Java Fonts which is not a font actually but maps some of the your physical font)
    Now there only 5 logical fonts as of now, and they are
    Dialog, DialogInput, SansSerif,Serif and Monospaced (All are available in Font class).

    Now AWT supports only these 5 logical fonts.
    So better option is to move to swing so that u can use all fonts are available.

Similar Threads

  1. operator || cant be applied to OlimpicFrog, boolean
    By darkblue24 in forum New To Java
    Replies: 2
    Last Post: 02-16-2010, 12:37 AM
  2. Replies: 4
    Last Post: 01-29-2010, 09:57 PM
  3. Replies: 5
    Last Post: 04-25-2009, 08:00 PM
  4. Error: cannot be applied to (java.lang.String)
    By carl in forum New To Java
    Replies: 1
    Last Post: 08-05-2007, 06:33 AM
  5. Replies: 1
    Last Post: 08-01-2007, 06:10 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
  •