减少 BlackBerry BasicEditField 的高度和宽度

发布于 2024-10-09 02:16:05 字数 1412 浏览 1 评论 0原文

我正在尝试更改 BlackBerry BasicEditField 的宽度和高度。 但正如我提到的,它没有显示 BasicEditField。

  HorizontalFieldManager HFMreg = 
      new HorizontalFieldManager(
           HorizontalFieldManager.USE_ALL_WIDTH 
         | HorizontalFieldManager.USE_ALL_HEIGHT) {
      //Override the paint method to draw the background image.
      public void paint(Graphics graphics) { 
          //Draw the registration background image
          graphics.drawBitmap(0,0,Display.getWidth(),Display.getHeight(),BMregbg, 0, 0);
          super.paint(graphics);
      }
  };

  BEFfirstname = new BasicEditField("","",5,EditField.NO_NEWLINE) {
      protected void paint(Graphics graphics) {
          graphics.fillRect(0,0,80,25);
          graphics.setBackgroundColor(Color.WHITE);
          graphics.clear();
          super.paint(graphics); 
      }

      protected void layout() {
          super.layout(getPreferredWidth(),getPreferredHeight());
          setExtent(80,25); //width,height
      }

      public int getPreferredWidth() {
          int fieldWidth = 80; //required width
          return fieldWidth;
      }

      public int getPreferredHeight() {
          int fieldHeight = 25; // required height
          return fieldHeight;
      }
  };
  //BEFfirstname.setMargin(200,0,0,60);

  HFMreg.add(LFfirstname);
  HFMreg.add(BEFfirstname);

  add(HFMreg);

I am trying to change the width and height of a BlackBerry BasicEditField.
But its not displaying the BasicEditField as i mention.

  HorizontalFieldManager HFMreg = 
      new HorizontalFieldManager(
           HorizontalFieldManager.USE_ALL_WIDTH 
         | HorizontalFieldManager.USE_ALL_HEIGHT) {
      //Override the paint method to draw the background image.
      public void paint(Graphics graphics) { 
          //Draw the registration background image
          graphics.drawBitmap(0,0,Display.getWidth(),Display.getHeight(),BMregbg, 0, 0);
          super.paint(graphics);
      }
  };

  BEFfirstname = new BasicEditField("","",5,EditField.NO_NEWLINE) {
      protected void paint(Graphics graphics) {
          graphics.fillRect(0,0,80,25);
          graphics.setBackgroundColor(Color.WHITE);
          graphics.clear();
          super.paint(graphics); 
      }

      protected void layout() {
          super.layout(getPreferredWidth(),getPreferredHeight());
          setExtent(80,25); //width,height
      }

      public int getPreferredWidth() {
          int fieldWidth = 80; //required width
          return fieldWidth;
      }

      public int getPreferredHeight() {
          int fieldHeight = 25; // required height
          return fieldHeight;
      }
  };
  //BEFfirstname.setMargin(200,0,0,60);

  HFMreg.add(LFfirstname);
  HFMreg.add(BEFfirstname);

  add(HFMreg);

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

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

发布评论

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

评论(1

毅然前行 2024-10-16 02:16:11

反过来说:

BasicEditField BEFfirstname = new BasicEditField("","",5,EditField.NO_NEWLINE);
 MyManager obj = new MyManger();
 obj.add(BEFfirstname);
 add(obj);




class MyManager extends Manager
     {
       MyManager()
        {
           super(Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT);
         }

        protected void sublayout(int width, int height)
        {
            Field f = getField(0);
              layoutChild(f,80,25);
              setPositionChild(f, 10, 10);      
        }
     }

just an other way round:

BasicEditField BEFfirstname = new BasicEditField("","",5,EditField.NO_NEWLINE);
 MyManager obj = new MyManger();
 obj.add(BEFfirstname);
 add(obj);




class MyManager extends Manager
     {
       MyManager()
        {
           super(Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT);
         }

        protected void sublayout(int width, int height)
        {
            Field f = getField(0);
              layoutChild(f,80,25);
              setPositionChild(f, 10, 10);      
        }
     }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文