How to use freely resizable font in in Java ME(4)
来源:未知 责任编辑:责任编辑 发表时间:2013-12-18 11:34 点击:次
}
protected void pointerDragged(int x, int y) { }
protected void pointerPressed(int x, int y) {
plusButton.selected = false;
minusButton.selected = false;
styleButton.selected = false;
if (checkButton(plusButton, x, y)) {
plusButton.selected = true;
fontHeight++;
}
else if (checkButton(minusButton, x, y)) {
minusButton.selected = true;
if (fontHeight > 0) fontHeight--;
}
else if (checkButton(styleButton, x, y)) {
styleButton.selected = true;
if (style < 7) style++;
else style = 0;
}
repaint();
}
protected void pointerReleased(int x, int y) {
plusButton.selected = false;
minusButton.selected = false;
styleButton.selected = false;
repaint();
}
protected void sizeChanged(int w, int h) {
width = w;
height = h;
repaint();
}
private boolean checkButton(Button button, int x, int y) {
boolean pressed = false;
boolean horizontal = false;
boolean vertical = false;
int x_edge = button.x + button.w;
int y_edge = button.y + button.h;
if (x > button.x && x < x_edge) horizontal = true;
if (y > button.y && y < y_edge) vertical = true;
if (horizontal && vertical) pressed = true;
相关新闻>>
- 发表评论
-
- 最新评论 更多>>