How to make a custom TextBoxField with rounded border on Blackberry? [closed]

十年热恋 提交于 2019-12-11 04:01:07

问题


I need make a textboxField on Blackberry with rounded border. I try make a custom textbox but it seem not good. Can anybody share me a class for good custom TextBoxField on Blackberry ?


回答1:


final Bitmap header_Bitmap = //background image;
    VerticalFieldManager vfm_ = new VerticalFieldManager(
            Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR
                    | Manager.NO_VERTICAL_SCROLL
                    | Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH) {
        public void paint(Graphics graphics) {
            graphics.setBackgroundColor(0x040811);
            graphics.clear();
            graphics.drawBitmap(0, 0, header_Bitmap.getWidth(),
                    header_Bitmap.getHeight(), header_Bitmap, 0, 0);
            super.paint(graphics);
        }
    };

 Bitmap borderBitmap = //the rounded image;
        VerticalFieldManager vfm_email = new VerticalFieldManager();
        vfm_email.setBorder(BorderFactory.createBitmapBorder(new XYEdges(5, 5,
                5, 5), borderBitmap));
        EmailAddressEditField email = new EmailAddressEditField("Email : ", "", 50, Field.FOCUSABLE);
        vfm_email.add(email);
        vfm_.add(vfm_email);
        add(vfm_);



回答2:


In the above code what should be written in the commented background image,"img.bmp" as it gives an error final Bitmap header_Bitmap = "img.bmp" ;//background image;

    VerticalFieldManager vfm_ = new VerticalFieldManager(
        Manager.NO_HORIZONTAL_SCROLL | Manager.NO_HORIZONTAL_SCROLLBAR
                | Manager.NO_VERTICAL_SCROLL
                | Manager.NO_VERTICAL_SCROLLBAR | Field.USE_ALL_WIDTH) 


来源:https://stackoverflow.com/questions/9226600/how-to-make-a-custom-textboxfield-with-rounded-border-on-blackberry

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!