Пример #1
0
  public UserInput() {
    super(USE_ALL_WIDTH);

    userField =
        new CustomEditField(
            FIELD_LEFT | BasicEditField.NO_NEWLINE | BasicEditField.NO_SWITCHING_INPUT);
    fontSetting.setPoint(Font.PLAIN, 7);
    userField.setFont(fontSetting.getFont());
    userField.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
    add(userField);

    Bitmap icon = Bitmap.getBitmapResource("icon_user.png");
    if (Variables.smallScreen()) {
      int newWidth = icon.getWidth() * 320 / 480;
      int newHeight = icon.getHeight() * 240 / 360;
      icon = ImageUtils.resizeBitmap(icon, newWidth, newHeight);
    }
    userImage = new BitmapField(icon);
    userImage.setBackground(BackgroundFactory.createSolidBackground(0xf7f7f7));
    userImage.setBorder(
        BorderFactory.createSimpleBorder(
            new XYEdges(1, 1, 1, 1),
            new XYEdges(Color.GRAY, Color.GRAY, Color.GRAY, Color.GRAY),
            Border.STYLE_SOLID));
    add(userImage);
  }
Пример #2
0
  public PassLockInput() {
    super(USE_ALL_WIDTH);

    passField =
        new CustomPasswordField("", "Password", 30, FIELD_LEFT | PasswordEditField.NO_NEWLINE);
    fontSetting.setPoint(Font.PLAIN, 7);
    passField.setFont(fontSetting.getFont());
    passField.setBackground(BackgroundFactory.createSolidBackground(Color.WHITE));
    add(passField);

    Bitmap icon = Bitmap.getBitmapResource("icon_lock.png");
    if (Variables.smallScreen()) {
      int newWidth = icon.getWidth() * 320 / 480;
      int newHeight = icon.getHeight() * 240 / 360;
      icon = ImageUtils.resizeBitmap(icon, newWidth, newHeight);
    }
    passImage = new BitmapField(icon);
    passImage.setBackground(BackgroundFactory.createSolidBackground(0xf7f7f7));
    passImage.setBorder(
        BorderFactory.createSimpleBorder(
            new XYEdges(1, 1, 1, 1),
            new XYEdges(Color.GRAY, Color.GRAY, Color.GRAY, Color.GRAY),
            Border.STYLE_SOLID));
    add(passImage);
  }