未选择 CustomButtonField

发布于 2024-08-28 08:37:13 字数 2152 浏览 4 评论 0原文

我无法选择自定义按钮字段

这是我的代码:-

 public MenuScreen() 
{
    super(Screen.DEFAULT_CLOSE);
         verticalOffset=Display.getWidth();
         menuBackgroundImage=Bitmap.getBitmapResource("com/greetings/Images/MenuBackground.jpg");
         categories=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/categoryon.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/categoryoff.png"),0);
         categories.setChangeListener(this);
         help=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/helpon.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/helpoff.png"),0);
         help.setChangeListener(this);
         developer=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/aboutuson.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/aboutuspoff.png"),0);
         developer.setChangeListener(this);


    VerticalFieldManager manager = new VerticalFieldManager()
    {
          protected void sublayout(int width, int height)
      {
              width=fwidth;
              height=fHeight;
              super.sublayout(width,height);
              setPositionChild(categories, width-240, height-350);
              setPositionChild(help, width-240, height-290);
              setPositionChild(developer, width-240, height-230);
              setExtent(width, height);
      }
    };
    manager.setBackground(BackgroundFactory.createBitmapBackground(menuBackgroundImage));
    manager.add(categories);
    manager.add(help);
    manager.add(developer);
    add(manager);

}
public void fieldChanged(Field field, int context) {
    if(field==categories)
    {
        templateCategories=new TemplateCategories(2);
    UiApplication.getUiApplication().pushScreen(templateCategories);

    }

    if(field== help)
    {
        helpScreen=new HelpScreen();
        UiApplication.getUiApplication().pushScreen(helpScreen);
    }

    if(field == developer)
    {
        developerScreen=new DeveloperScreen();
        UiApplication.getUiApplication().pushScreen(developerScreen);
    }

}

当我单击“帮助”或“开发人员”按钮时,它不会选择。

I am not able select the custombuttonfield

Here is my code:-

 public MenuScreen() 
{
    super(Screen.DEFAULT_CLOSE);
         verticalOffset=Display.getWidth();
         menuBackgroundImage=Bitmap.getBitmapResource("com/greetings/Images/MenuBackground.jpg");
         categories=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/categoryon.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/categoryoff.png"),0);
         categories.setChangeListener(this);
         help=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/helpon.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/helpoff.png"),0);
         help.setChangeListener(this);
         developer=new CustomSmallButton(Bitmap.getBitmapResource("com/greetings/ButtonImage/aboutuson.png"),Bitmap.getBitmapResource("com/greetings/ButtonImage/aboutuspoff.png"),0);
         developer.setChangeListener(this);


    VerticalFieldManager manager = new VerticalFieldManager()
    {
          protected void sublayout(int width, int height)
      {
              width=fwidth;
              height=fHeight;
              super.sublayout(width,height);
              setPositionChild(categories, width-240, height-350);
              setPositionChild(help, width-240, height-290);
              setPositionChild(developer, width-240, height-230);
              setExtent(width, height);
      }
    };
    manager.setBackground(BackgroundFactory.createBitmapBackground(menuBackgroundImage));
    manager.add(categories);
    manager.add(help);
    manager.add(developer);
    add(manager);

}
public void fieldChanged(Field field, int context) {
    if(field==categories)
    {
        templateCategories=new TemplateCategories(2);
    UiApplication.getUiApplication().pushScreen(templateCategories);

    }

    if(field== help)
    {
        helpScreen=new HelpScreen();
        UiApplication.getUiApplication().pushScreen(helpScreen);
    }

    if(field == developer)
    {
        developerScreen=new DeveloperScreen();
        UiApplication.getUiApplication().pushScreen(developerScreen);
    }

}

when i am clicking help or developer button its not selecting.

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

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

发布评论

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

评论(1

墨洒年华 2024-09-04 08:37:13

覆盖

protected void drawFocus(Graphics graphics,boolean on) {
                                //code for custom focus like draw onFocusbitmap
                                super.drawFocus(graphics, on);
                            }

您的 CustomSmallButton 类中的

override the

protected void drawFocus(Graphics graphics,boolean on) {
                                //code for custom focus like draw onFocusbitmap
                                super.drawFocus(graphics, on);
                            }

in your CustomSmallButton class

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