Beispiel #1
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);
  }
Beispiel #2
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);
  }
Beispiel #3
0
public class PassLockInput extends Manager {

  private FontSetting fontSetting = FontSetting.getInstance();

  private BitmapField passImage;
  private CustomPasswordField passField;

  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);
  }

  protected void sublayout(int width, int height) {
    layoutChild(passImage, width, height);
    layoutChild(passField, width - (passImage.getWidth() + 7), height);

    setPositionChild(passField, 6, (passImage.getHeight() - passField.getHeight()) / 2);
    setPositionChild(passImage, width - passImage.getWidth(), 0);

    setExtent(width, passImage.getHeight());
  }

  protected void paint(Graphics g) {
    g.setColor(Color.WHITE);
    g.fillRect(0, 0, passField.getWidth() + 8, passImage.getHeight());

    g.setColor(Color.GRAY);
    g.drawRect(0, 0, passField.getWidth() + 8, passImage.getHeight());

    super.paint(g);
  }

  public String getValue() {
    return passField.getText().trim();
  }
}