影像地图般的黑莓控制 - CLDC应用 [英] Image Map-like Blackberry Control - CLDC Application
问题描述
有谁知道一个图像像地图,黑莓控制,我可以在我的CLDC应用程序中使用的?如果没有一个,有没有办法让点击x,y坐标上MainScreen或BitmapField衍生控制?
Does anyone know of an Image Map-like Blackberry Control that I can use in my CLDC application? If there isn't one, is there a way to get click x,y coordinates on a MainScreen or BitmapField derived control?
谢谢,
推荐答案
我假设你在想这个控制风暴的 - 需要点击屏幕上的任意点有意义的唯一设备
I assume you're thinking of this control for the Storm - the only device for which clicking on an arbitrary point on screen makes sense.
在这种情况下,最简单的方法可能是继承BitmapField要成为焦点,并响应点击 - 是这样的:
In that case, the easiest way is probably to subclass BitmapField to be focusable and respond to clicks - something like this:
public class ClickableBitmapField extends BitmapField {
// Make the control focusable
public boolean isFocusable() {
return true;
}
protected boolean touchEvent(TouchEvent message) {
if (message.getEventCode == TouchEvent.CLICK) {
int x = message.getX();
int y = message.getY();
// do something with x and y here
}
}
}
当然,这会是一个复杂得多实现了轨迹球设备图像映射类型的功能 - 你必须让用户知道他们去哪里点击保持光标或东西。
Of course it'd be a lot more complicated to implement image map type functionality for a trackball device - you'd have to maintain a cursor or something so the user knows where they're clicking.
这篇关于影像地图般的黑莓控制 - CLDC应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!