黑莓设置全屏一个RichtextField的位置 [英] Blackberry setting the position of a RichtextField in FullScreen

查看:145
本文介绍了黑莓设置全屏一个RichtextField的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的黑莓,我想要在屏幕的全屏的paint方法,并在同一时间的顶部做一些自定义的绘画应用程序,我想定位在屏幕下部的RichtextField 。我试着用Field类setPosition两种方法,但都无济于事。所以,我怎么设置添加到全屏类RichtextField的位置?

I am writing an application in BlackBerry, where I want to do some custom painting at the top portion of the screen in the paint method of FullScreen and at the same time, I want a RichtextField positioned at the lower portion of the screen. I tried using setPosition methods in the Field class, but to no avail. So how do I set the position of the RichtextField that is added to the FullScreen class?

推荐答案

您可以使用 SpacerField 用于这一目的:

You can use a SpacerField for that purpose:

class SpacerField extends Field {

  int localWidth, localHeight;

  SpacerField(int width, int height) {
    super(Field.NON_FOCUSABLE);
    localWidth = width;
    localHeight = height;
  }

  protected void layout(int width, int height) {
    // TODO Auto-generated method stub
    setExtent(localWidth, localHeight);
  }


  protected void paint(Graphics graphics) {

  }


  public int getPreferredWidth() {
    return localWidth;
  }

  public int getPreferredHeight() {
    return localHeight;
  }
}

和它的前RichTextField添加到您的屏幕。一定要给予适当的宽度 Display.getWidth()?)和高度构建SpacerField时。

and add it to your Screen before your RichTextField. Be sure to give a suitable width (Display.getWidth() ?) and height when constructing the SpacerField.

注:我已经找到了code。在<一个href=\"http://supportforums.blackberry.com/rim/board/message?board.id=java%5Fdev&message.id=46477#M46477\"当我需要做同样的事情相对=nofollow>这个论坛讨论的几个月前。

Note: I had found the code at this forum discussion a few months ago when I needed to do something similar.

这篇关于黑莓设置全屏一个RichtextField的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆