类似图像映射的 Blackberry 控件 - CLDC 应用程序

发布于 2024-07-17 10:03:07 字数 130 浏览 3 评论 0原文

有谁知道我可以在 CLDC 应用程序中使用类似图像映射的 Blackberry Control? 如果没有,是否有一种方法可以获取 MainScreen 或 BitmapField 派生控件上的单击 x,y 坐标?

谢谢,

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?

Thanks,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清醇 2024-07-24 10:03:07

我假设您正在考虑 Storm 的这种控制 - 唯一可以单击屏幕上任意点的设备。

在这种情况下,最简单的方法可能是将 BitmapField 子类化以使其可聚焦并响应点击 - 像这样:

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
    }
}
}

当然,为轨迹球设备实现图像映射类型功能要复杂得多 - 您必须保持光标或其他东西,以便用户知道他们点击的位置。

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文