Creating advanced user interfaces blackberry

人盡茶涼 提交于 2019-12-11 11:07:36

问题


I am looking out to create a text box similar to the image shown below in my blackberry form. As of now i am able to add a textfield which has a label like say

              Name:(Cursor blinks)

Also when i try adding an image it doesnt show up beside the label but below it.I have tried aligning and adjusting image size etc but all in vain.How can layout managers help me do this any idea?

Can some one provide me an exact way as to how this can be achieved.Thanks in advance.

     //Lets say adding  textfield with validation for name
     TextField1 = new TextField("\n Customer Name: ",null)
     {
            protected boolean keyChar(char ch, int status, int time) 
            {
            if (CharacterUtilities.isLetter(ch) || (ch == Characters.BACKSPACE || (ch == Characters.SPACE))) 
            {
            return super.keyChar(ch, status, time);
            }
           return true;
            }
        };
       add(TextField1);

      //Or either by using this,the text is placed within the image
    Border myBorder = BorderFactory.createBitmapBorder( 
    new XYEdges(20, 16, 27, 23),
    Bitmap.getBitmapResource("border.png"));
    TextField myField = new TextField(" Write something ",TextField.USE_ALL_WIDTH | TextField.FIELD_HCENTER)
    {
      protected void paint(Graphics g) {
        g.setColor(Color.BLUE);
        super.paint(g);
    }
    };  

   myField.setBorder(myBorder);
   add(myField);

//After trying out code given at Blackberry App Appearance VS Facebook App i am getting the following layout

I would still want to achieve a box that stands beside the label.Like the one shown in green image.Please guide.


回答1:


Have a look to this answer. I think it may be helpful to you. Just play with the code until you get your desired look and feel.



来源:https://stackoverflow.com/questions/10589513/creating-advanced-user-interfaces-blackberry

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