Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Software (http://www.velocityreviews.com/forums/f6-software.html)
-   -   J2ME Font settings on form (http://www.velocityreviews.com/forums/t739406-j2me-font-settings-on-form.html)

golemnagesh 12-03-2010 12:05 PM

J2ME Font settings on form
 
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

sbglobal2010 12-15-2010 06:08 PM

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;
}

}


All times are GMT. The time now is 09:28 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57