当前位置: 首页>>代码示例>>Java>>正文


Java TextField.setPasswordCharacter方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.TextField.setPasswordCharacter方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setPasswordCharacter方法的具体用法?Java TextField.setPasswordCharacter怎么用?Java TextField.setPasswordCharacter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.TextField的用法示例。


在下文中一共展示了TextField.setPasswordCharacter方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: process

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final TextField actor,
        final String rawAttributeData) {
    final String passwordCharacter = parser.parseString(rawAttributeData, actor);
    if (Strings.isEmpty(passwordCharacter)) {
        parser.throwError("Password character setting cannot be empty. String with length of 1 is required.");
    } else if (passwordCharacter.length() != 1) {
        parser.throwErrorIfStrict("String with length of 1 is required for password character setting.");
    }
    // At this point, string must have at least 1 character.
    actor.setPasswordCharacter(passwordCharacter.charAt(0));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:13,代码来源:PasswordCharacterLmlAttribute.java

示例2: CreateGameDialogActor

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
public CreateGameDialogActor(Skin skin) {
	super("", skin);
	createGameDialog = new CreateGameDialog();
	
	TextButton createGameButton = new TextButton("Create Game", skin, "textButtonLarge");
	Label gameNameLabel = new Label("Game Name", skin);
	Label gamePasswordLabel = new Label("Password", skin);
	Label gamePasswordRepeatLabel = new Label("Repeat password", skin);
	TextField gameNameText = createGameDialog.getGameNameText();
	final TextField gamePasswordText = createGameDialog.getGamePasswordText();
	final TextField gamePasswordRepeatText = createGameDialog.getGamePasswordRepeatText();
	CheckBox showPasswordCheckBox = new CheckBox("  Show Password", skin);
	
	getButtonTable().defaults().width(175).height(100);
	
	getContentTable().padTop(40);
	getContentTable().add(gameNameLabel);
	getContentTable().add(gameNameText).row();
	getContentTable().add(gamePasswordLabel);
	getContentTable().add(gamePasswordText).row();
	getContentTable().add(gamePasswordRepeatLabel);
	getContentTable().add(gamePasswordRepeatText).row();
	getContentTable().add(showPasswordCheckBox).colspan(2).center();
	getButtonTable().padTop(50);
	button(createGameButton, "Register");
	
	gamePasswordText.setPasswordCharacter('*');
	gamePasswordText.setPasswordMode(true);
	gamePasswordRepeatText.setPasswordCharacter('*');
	gamePasswordRepeatText.setPasswordMode(true);
	
	showPasswordCheckBox.addListener(new ChangeListener() {
		public void changed (ChangeEvent event, Actor actor) {
			gamePasswordText.setPasswordMode(!gamePasswordText.isPasswordMode());
			gamePasswordRepeatText.setPasswordMode(!gamePasswordRepeatText.isPasswordMode());
		}
	});
}
 
开发者ID:javosuher,项目名称:Terminkalender,代码行数:39,代码来源:CreateGameDialogActor.java

示例3: TeacherRegisterDialogActor

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
public TeacherRegisterDialogActor(Skin skin) {
	super("", skin);
	teacherRegisterDialog = new TeacherRegisterDialog(); 

	TextButton registerButton = new TextButton("Register", skin, "textButtonLarge");
	Label userLabel = new Label("Username", skin);
	Label passwordLabel = new Label("Password", skin);
	Label passwordRepeatLabel = new Label("Repeat password", skin);
	TextField userText = teacherRegisterDialog.getUserText();
	final TextField passwordText = teacherRegisterDialog.getPasswordText();
	final TextField passwordRepeatText = teacherRegisterDialog.getPasswordRepeatText();
	CheckBox showPasswordCheckBox = new CheckBox("  Show Password", skin);
	
	getButtonTable().defaults().width(175).height(100);
	
	getContentTable().padTop(40);
	getContentTable().add(userLabel);
	getContentTable().add(userText).row();
	getContentTable().add(passwordLabel);
	getContentTable().add(passwordText).row();
	getContentTable().add(passwordRepeatLabel);
	getContentTable().add(passwordRepeatText).row();
	getContentTable().add(showPasswordCheckBox).colspan(2).center();
	getButtonTable().padTop(50);
	button(registerButton, "Register");
	
	passwordText.setPasswordCharacter('*');
	passwordText.setPasswordMode(true);
	passwordRepeatText.setPasswordCharacter('*');
	passwordRepeatText.setPasswordMode(true);
	
	showPasswordCheckBox.addListener(new ChangeListener() {
		public void changed (ChangeEvent event, Actor actor) {
			passwordText.setPasswordMode(!passwordText.isPasswordMode());
			passwordRepeatText.setPasswordMode(!passwordRepeatText.isPasswordMode());
		}
	});
}
 
开发者ID:javosuher,项目名称:Terminkalender,代码行数:39,代码来源:TeacherRegisterDialogActor.java

示例4: TeacherLoginDialogActor

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
public TeacherLoginDialogActor(Skin skin) {
	super("", skin);
	teacherLoginDialog = new TeacherLoginDialog(); 

	TextButton registerButton = new TextButton("Login", skin, "textButtonLarge");
	Label userLabel = new Label("Username", skin);
	Label passwordLabel = new Label("Password", skin);
	TextField userText = teacherLoginDialog.getUserText();
	final TextField passwordText = teacherLoginDialog.getPasswordText();
	CheckBox showPasswordCheckBox = new CheckBox("  Show Password", skin);
	showPasswordCheckBox.right();
	
	getButtonTable().defaults().width(175).height(100);
	
	getContentTable().padTop(40);
	getContentTable().add(userLabel);
	getContentTable().add(userText).row();
	getContentTable().add(passwordLabel);
	getContentTable().add(passwordText).row();
	getContentTable().add(showPasswordCheckBox).colspan(2).center();
	getButtonTable().padTop(50);
	button(registerButton, "Login");
	
	passwordText.setPasswordCharacter('*');
	passwordText.setPasswordMode(true);
	showPasswordCheckBox.setChecked(false);
	
	showPasswordCheckBox.addListener(new ChangeListener() {
		public void changed (ChangeEvent event, Actor actor) {
			passwordText.setPasswordMode(!passwordText.isPasswordMode());
		}
	});
}
 
开发者ID:javosuher,项目名称:Terminkalender,代码行数:34,代码来源:TeacherLoginDialogActor.java

示例5: RegistrationPanel

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
public RegistrationPanel() {
	final TextField userid_field = new TextField("", Resources._skin);
	userid_field.setMaxLength(Settings._max_reister_userid_length);
	userid_field.setMessageText("user id");
	
	final TextField username_field = new TextField("", Resources._skin);
	username_field.setMaxLength(Settings._max_reister_username_length);
	username_field.setMessageText("username");
	
	final TextField password_field = new TextField( "", Resources._skin);
	password_field.setPasswordMode(true);
	password_field.setPasswordCharacter('*');
	password_field.setMaxLength(30);
	password_field.setMessageText("password");
	
	TextButton register_button = new TextButton("Register", Resources._skin);
	register_button.setPosition(180, 320);
	register_button.addListener(new ClickListener(){
		RegistrationInfo__ ri = new RegistrationInfo__();
		float last_try;
		
		@Override
		public void clicked(InputEvent event, float x, float y) {
			if ( current_time - last_try > 1 ) {
				String raw_username = username_field.getText();
				String raw_userid = userid_field.getText();
				String raw_password = password_field.getText();
				
				if ( raw_username.length() < Settings._min_reister_username_length ) {
					Resources._messbar.setText("Error: username is too short, needs at least "+(Settings._min_reister_username_length+1)+" characters");
					return;
				}
				if ( raw_password.length() < Settings._min_reister_password_length ) {
					Resources._messbar.setText("Error: password is too short, needs at least "+(Settings._min_reister_password_length+1)+" characters");
					return;
				}
				
				if ( raw_password.length() < Settings._min_reister_userid_length ) {
					Resources._messbar.setText("Error: user id is too short, needs at least "+(Settings._min_reister_password_length+1)+" characters");
					return;
				}
				ri.username = raw_username.getBytes();
				ri.one_time_hashed_password = Resources._hash.sha1(raw_password).getBytes();
				ri.userid = raw_userid.getBytes();
				Resources._nclient.sendRegistrationInfo(ri);
				last_try = current_time;
			} else {
				Resources._messbar.setText("Please slow down click speed");
			}
		}
	});
	
	defaults().pad(3, 0, 3, 0);
	defaults().left();
	
	add(username_field).width(200).row();
	add(password_field).width(200).row();
	add(userid_field).width(200).row();
	add(register_button).colspan(2).right();
	
	//debug();
}
 
开发者ID:s76,项目名称:zesp2013,代码行数:63,代码来源:RegistrationPanel.java

示例6: LoginPanel

import com.badlogic.gdx.scenes.scene2d.ui.TextField; //导入方法依赖的package包/类
public LoginPanel() {
		final TextField username_field = new TextField("", Resources._skin);
//		FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/SuperRound.ttf"));
//		username_field.getStyle().font = generator.generateFont(12);
		username_field.setMaxLength(Settings._max_reister_username_length);
		username_field.setMessageText("username ");
		
		
		final TextField password_field = new TextField( "", Resources._skin);
		password_field.setPasswordMode(true);
		password_field.setPasswordCharacter('*');
		password_field.setMessageText("password ");
		password_field.setMaxLength(30);
		
		TextButton login_button = new TextButton("Login", Resources._skin);
		login_button.addListener(new ClickListener(){
			LoginInfo__ li = new LoginInfo__();
			float last_try;
			
			@Override
			public void clicked(InputEvent event, float x, float y) {
				if ( current_time - last_try > 1 ) {
					last_try = current_time;
					if ( !Resources._nclient.isConnected()){
						Resources._messbar.setText("Error: no connection");
						return;
					}
					
					String raw_username = username_field.getText();
					String raw_password = password_field.getText();
					
					if ( raw_username.length() < Settings._min_reister_username_length ) {
						Resources._messbar.setText("Error: username is too short, needs at least "+Settings._min_reister_username_length+" characters");
						return;
					}
					if ( raw_password.length() < Settings._min_reister_password_length ) {
						Resources._messbar.setText("Error: password is too short, needs at least "+Settings._min_reister_password_length+" characters");
						return;
					}
					
					li.username = raw_username.getBytes();
					li.one_time_hashed_password = Resources._hash.sha1(raw_password).getBytes();
					
					Resources._nclient.sendLoginInfo(li);
					Resources._messbar.setText("Trying loging in", true);
				} else {
					Resources._messbar.setText("Please slow down click speed");
				}
			}
		});
		
		defaults().pad(3, 0, 3, 0);
		defaults().left();
		
		add(username_field).width(200).row();
		add(password_field).width(200).row();
		add(login_button).colspan(2).right();
		
		//debug();
	}
 
开发者ID:s76,项目名称:zesp2013,代码行数:61,代码来源:LoginPanel.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.TextField.setPasswordCharacter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。