![]() |
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 |
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.