Source Code : Box Text Canvas
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Box Text Canvas

import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
public class BoxTextCanvas extends Canvas {
private Font mFont;
public BoxTextCanvas() {
mFont = Font.getFont(Font.FACE_PROPORTIONAL, Font.STYLE_PLAIN, Font.SIZE_LARGE);
}
public void paint(Graphics g) {
int w = getWidth();
int h = getHeight();
g.setColor(0xffffff);
g.fillRect(0, 0, w, h);
g.setColor(0x000000);
String s = "dolce";
int stringWidth = mFont.stringWidth(s);
int stringHeight = mFont.getHeight();
int x = (w - stringWidth) / 2;
int y = h / 2;
g.setFont(mFont);
g.drawString(s, x, y, Graphics.TOP | Graphics.LEFT);
g.drawRect(x, y, stringWidth, stringHeight);
}
}
Thank with us