📄 button.java
字号:
/**
*按钮控件
*@CopyRight:Move2008
*@Author:bedlang
*@Version 1.0 2003/8/5
*/
package mmae.ui;
import javax.microedition.lcdui.*;
import mmae.util.Tool;
public class Button extends Base
{
String text;
Image img;
public Button(Image I, String Caption, int X, int Y)
{
img = I;
setPosition(X, Y);
text = Caption;
}
public Button(Image I, String Caption)
{
img = I;
text = Caption;
}
public void draw(Graphics g, int x, int y)
{
setPosition(x, y);
draw(g);
}
public void draw(Graphics g)
{
g.drawImage(img, left, top, g.TOP|g.LEFT);
if(colorBackR==-1)
g.setColor(0);
else
g.setColor(colorBackR, colorBackG, colorBackB);
g.drawString(text, (img.getWidth()-Tool.getStrWidth(text))/2+left,
(img.getHeight()-Tool.getFontHeight())/2+top, g.TOP|g.LEFT);
}
public int getWidth()
{
return img.getWidth();
}
public int getHeight()
{
return img.getHeight();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -