Bold Style Font : Font « J2ME « Java Tutorial

Bold Style Font
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import javax.microedition.midlet.MIDlet;

public class BoldFontMidlet extends MIDlet {
  public BoldFontMidlet() { // constructor

  public void startApp() {
    Canvas canvas = new FontCanvas();
    Display display = Display.getDisplay(this);

  public void pauseApp() {

  public void destroyApp(boolean unconditional) {

class FontCanvas extends Canvas {
  public void paint(Graphics g) {
    g.fillRect(0, 0, getWidth(), getHeight());

    g.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM));
    g.drawString("Bold Style", 0, 30, g.LEFT | g.TOP);

31.30.1.Get font widthGet font width
31.30.2.Font styleFont style
31.30.3.System FontSystem Font
31.30.4.Medium Sized fontMedium Sized font
31.30.5.Bold Style FontBold Style Font
31.30.6.Italic Style FontItalic Style Font
31.30.7.Underlined Style FontUnderlined Style Font
31.30.8.Get width and heightGet width and height