ImageTextControl.java
资源名称:src.zip [点击查看]
上传用户:luxiaowei
上传日期:2022-06-06
资源大小:58k
文件大小:1k
源码类别:
J2ME
开发平台:
Java
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.framework;
- import javax.microedition.lcdui.Graphics;
- import javax.microedition.lcdui.Image;
- /**
- *
- * @author swaroop_kumar
- */
- public class ImageTextControl extends ImageControl {
- GTantra font;
- String text;
- private int fontPallet;
- int charHeight = 0;
- public void setPallet(int pallet) {
- this.fontPallet=pallet;
- }
- public ImageTextControl(Image image,String text,GTantra font) {
- super(image);
- this.font = font;
- this.text = text;
- charHeight = Util.getMaxCharHeight(font,text);
- }
- public void paint(Graphics g) {
- super.paint(g);
- font.setCurrentPallete(fontPallet);
- font.drawString(g, text, getWidth() >> 1, (getHeight() - charHeight) >> 1, GTantra.TEXT_HCENTER);
- }
- }