Results 1 to 4 of 4

Thread: Using Fonts

  1. #1
    Anurag31d is offline Member
    Join Date
    Apr 2012
    Posts
    1
    Rep Power
    0

    Default Using Fonts

    What's wrong with my code?

    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    /*
    <applet code="FontA.class" width=300 height=300>
    </applet>
    */
    public class FontA extends Applet
    {
    public void init()
    {
    Font f=new Font("Dialog",Font.PLAIN,14);
    int setFont(f);
    }
    public void paint(Graphics g)
    {
    String msg="Bold";
    g.drawString(msg,30,30);
    }
    }

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Using Fonts

    Quote Originally Posted by Anurag31d View Post
    What's wrong with my code?
    You tell us. What errors do you see when trying to compile or run it?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    zonic is offline Member
    Join Date
    Apr 2012
    Posts
    4
    Rep Power
    0

    Default Re: Using Fonts

    "int setFont(f);" should be only "setFont(f); "

    your code is fine

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,188
    Rep Power
    19

    Default Re: Using Fonts

    zonic, don't spoonfeed. Give a questioner a chance to learn not just Java but how to ask a question in a way that gets a good answer in one shot.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. How do I mix different fonts in the same text box
    By madroadbiker in forum AWT / Swing
    Replies: 3
    Last Post: 05-26-2011, 02:24 AM
  2. What every developer should know about fonts
    By david@windward.net in forum Java 2D
    Replies: 0
    Last Post: 12-03-2010, 11:08 PM
  3. want to know how to add new fonts in ireport 2.04
    By sudhakarrs in forum Advanced Java
    Replies: 0
    Last Post: 10-02-2010, 05:59 PM
  4. Strings and fonts
    By TheGoodGuy in forum New To Java
    Replies: 12
    Last Post: 09-05-2010, 02:01 AM
  5. Fonts (Changing Fonts and Color's)
    By dbashby in forum New To Java
    Replies: 10
    Last Post: 04-06-2009, 01:32 AM

Tags for this Thread

Posting Permissions

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