J2ME Font settings on form

Discussion in 'Software' started by golemnagesh, Dec 3, 2010.

  1. golemnagesh

    golemnagesh

    Joined:
    Dec 3, 2010
    Messages:
    3
    Location:
    India,Hyd
    Hi All,

    I am struck in mobile application for setting up font styles on form, but i can do with Canvas for Font settings, if i used Canvas class i can only drawString or Image with paint method, but i need to use form, with all like Commands, TextFields and along with background Image and Font settings

    Can you please anyone to help
    I am very thankful who read this to reply me


    Thank You
    golemnagesh, Dec 3, 2010
    #1
    1. Advertising

  2. golemnagesh

    sbglobal2010

    Joined:
    Dec 15, 2010
    Messages:
    6
    This is the Sample code,

    class DecodeCanvas extends Canvas {
    private changeFont parent = null;

    private int width = getWidth();
    private int height = getHeight();


    public DecodeCanvas(changeFont parent) {
    this.parent = parent;

    }

    public void paint(Graphics g) {


    g.setColor(WHITE);
    g.fillRect(0, 0, width, height);


    Font f1 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_LARGE);
    Font f2 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_MEDIUM);
    Font f3 = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL);
    int yPos = 0;
    if (COLOR)
    g.setColor(BLUE);
    else
    g.setColor(LIGHT_GRAY);

    g.fillRect(0, yPos, width, f1.getHeight());

    if (COLOR)
    g.setColor(WHITE);
    else
    g.setColor(BLACK);
    g.setFont(f1);
    g.drawString("BIG FONT", 0, yPos, Graphics.LEFT | Graphics.TOP);
    yPos = yPos + f1.getHeight() + 10;
    g.setFont(f2);
    // g.drawLine(0, f1.getHeight() + yPos - 1, width, f1.getHeight() + yPos - 1);
    g.drawString("MEDIUM FONT", 0, yPos, Graphics.LEFT | Graphics.TOP);
    g.setColor(BLACK);
    //g.drawLine(0, f2.getHeight() + yPos - 1, width, f2.getHeight() + yPos - 1);

    yPos = yPos + f1.getHeight() + 10;
    g.setFont(f3);
    g.drawString("SMALL FONT", 0, yPos, Graphics.LEFT | Graphics.TOP);
    yPos = yPos + f1.getHeight() + 10;
    g.drawLine(0, f3.getHeight() + yPos - 1, width, f3.getHeight() + yPos - 1);

    painting = false;
    }

    }
    sbglobal2010, Dec 15, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. asj
    Replies:
    5
    Views:
    1,239
    ifteebuet
    Jul 27, 2006
  2. slchslch
    Replies:
    0
    Views:
    1,234
    slchslch
    Sep 8, 2006
  3. Lookout

    Windows XP explorer font and font size

    Lookout, Jun 4, 2006, in forum: Computer Support
    Replies:
    0
    Views:
    608
    Lookout
    Jun 4, 2006
  4. chintan
    Replies:
    0
    Views:
    1,697
    chintan
    Dec 19, 2007
  5. andreasbell

    creating font with fixed font size

    andreasbell, Aug 30, 2010, in forum: Software
    Replies:
    1
    Views:
    1,159
    Hotspot
    Aug 30, 2010
Loading...

Share This Page