How to use freely resizable font in in Java ME(2)

来源:未知 责任编辑:责任编辑 发表时间:2013-12-18 11:34 点击:

        else Display.getDisplay(this).setCurrent(alert);
    }
}


[edit]
Source code: FontCanvas.java
import javax.microedition.lcdui.Canvas;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;
import com.nokia.mid.ui.DirectUtils;
import com.nokia.mid.ui.TactileFeedback;
 
public class FontCanvas extends Canvas implements CommandListener {
    private FontSizingMIDlet midlet;
    private Command exitCommand;
    private String heightString = "";
    private String fontString = "";
    private Font font;
    private int fontHeight = 20;
    private int buttonFontHeight = 20;
    private int face = 0;
    private int style = 0;
    private int edge = 0;
    private int width;
    private int height;
    private TactileFeedback tactileFeedback;
    private boolean touchFeedback = false;
    private Button plusButton;
    private Button minusButton;
    private Button styleButton;
    private boolean init = false;
 
    public FontCanvas(FontSizingMIDlet midlet) {
        this.midlet = midlet;
        exitCommand = new Command("Exit", Command.EXIT, 1);
        this.addCommand(exitCommand);
        this.setCommandListener(this);
        tactileFeedback = new TactileFeedback();
        touchFeedback = tactileFeedback.isTouchFeedbackSupported();
    }
 
    public void paint(Graphics g) {
        if (!init) {
            width = getWidth();
            height = getHeight();
            plusButton = new Button(60, 25, "HEIGHT+");
            minusButton = new Button(60, 25, "HEIGHT-");
            styleButton = new Button(60, 25, "STYLE");
        }
        heightString = "Font height = " + fontHeight;
        fontString = "Style = " + style + ", face = " + face;

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • Java编程语言的八大优点
  • JVM对象生命周期详细介绍
  • Java平台上的CRM系统
  • Java 算数测试小程序
  • Java环境 使用Resin在NT环境下配置JSP环境
  • Command(命令模式)
  • Java 一个简单的画图程序
  • Java 日历的小程序
  • Java 统计代码的小工具
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1