List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development
Showing posts with label Login page. Show all posts
Showing posts with label Login page. Show all posts

Tuesday, April 17, 2012

Creating Login page with Border in Blackberry














  1. final Bitmap borderBitmap = Bitmap.getBitmapResource("rounded.png");

     VerticalFieldManager vfm_email = new VerticalFieldManager(Field.FIELD_VCENTER | Manager.HORIZONTAL_SCROLL);
          vfm_email.setBorder(
              BorderFactory.createBitmapBorder(
                  new XYEdges(12,12,12,12), borderBitmap
              )
          ); 
          vfm_email.setMargin(40, 10, 0, 10);
          final EmailAddressEditField email_edit = new EmailAddressEditField("", "", 30, BasicEditField.FILTER_DEFAULT){
    String emptyString = "Enter Email";
                protected void paintBackground(Graphics g) {
                    g.setBackgroundColor(0xFFFFFF);
                    g.clear();
                }
                protected void paint(Graphics g) {
                    int oldColor = g.getColor();
                    try {
                        g.setColor(0x000000);
                        test = super.getText();
                        if ( test == null || test.length() < 1 ) {
                            //g.setColor(Config.hint_colour);
                            g.drawText(emptyString, 0, 0);
                        }
                        super.paint(g);
                    } finally {
                        g.setColor(oldColor);
                    }
                }
      };
      vfm_email.add(email_edit);
    add(vfm_email);
      
    //password
    VerticalFieldManager vfm_password = new VerticalFieldManager(Manager.HORIZONTAL_SCROLL);
           vfm_password.setBorder(
                BorderFactory.createBitmapBorder(
                    new XYEdges(12,12,12,12), borderBitmap
                )
           ); 
           vfm_password.setMargin(0, 10, 0, 10);
           final PasswordEditField password_edit = new PasswordEditField("", "") {
               String emptyString = "Enter Password";
               protected void paintBackground(Graphics g) {
                    g.setBackgroundColor(0xFFFFFF);
                    g.clear();
               }
               protected void paint(Graphics g) {
                    int oldColor = g.getColor();
                    try {
                        g.setColor(0x000000);
                        test = super.getText();
                        if ( test == null || test.length() < 1 ) {
                            //g.setColor(Config.hint_colour);
                            g.drawText(emptyString, 0, 0);
                        }
                        super.paint(g);
                    } finally {
                        g.setColor(oldColor);
                    }
               }
           };
           vfm_password.add(password_edit);
         add( vfm_password );

    rounded.png is given below -