本文整理汇总了Java中de.lessvoid.nifty.controls.TextField类的典型用法代码示例。如果您正苦于以下问题:Java TextField类的具体用法?Java TextField怎么用?Java TextField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextField类属于de.lessvoid.nifty.controls包,在下文中一共展示了TextField类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: show
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
public void show(Nifty nifty, final String message) {
this.nifty = nifty;
ScreenBuilder builder;
if (Constants.android) {
builder = createAndroid(message);
} else {
builder = createDesktop(message);
}
Screen scr = builder.build(nifty);
textField = scr.findNiftyControl("textField", TextField.class);
nifty.addScreen(SCREEN_ID, scr);
nifty.gotoScreen(SCREEN_ID);
}
示例2: bind
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
super.bind(nifty, screen);
// login
tfEmail = (TextField) nifty.getScreen("start").
findNiftyControl("tfEmail", TextField.class);
tfPassword = (TextField) nifty.getScreen("start").
findNiftyControl("tfPassword", TextField.class);
lbCheck = (Label) nifty.getScreen("start").
findNiftyControl("lbCheck", Label.class);
// register
tfRegName = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegName", TextField.class);
tfRegEmail = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegEmail", TextField.class);
tfRegPassword = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegPassword", TextField.class);
tfRegPassword2 = (TextField) nifty.getScreen("start").
findNiftyControl("tfRegPassword2", TextField.class);
lbRegCheck = (Label) nifty.getScreen("start").
findNiftyControl("lbRegCheck", Label.class);
}
示例3: onStartScreen
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
@Override
public void onStartScreen() {
textfieldChat = screen.findNiftyControl("textfieldChat", TextField.class);
panelToolTip = screen.findElementByName("panelToolTip");
layerHUD = screen.findElementByName("layerHUD");
panelPortal = screen.findElementByName("panelPortal");
panelPortal.hide();
for (Element e : notificationElements) {
recursiveElementRemoval(nifty, screen, e);
}
notificationElements.clear();
notificationControls.clear();
Iterator<Message> itr = messages.iterator();
while (itr.hasNext()) {
Message m = itr.next();
m.remove();
itr.remove();
}
screen.getFocusHandler().setKeyFocus(null);
}
示例4: startGame
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
public void startGame() {
//TODO: without a player one cannot start
String mapName = screen.findElementById("mapNameLabel").getRenderer(TextRenderer.class).getOriginalText();
List<Element> children = playerScrollPanelPanel.getChildren();
ArrayList<Player> players = new ArrayList<Player>();
for (int i = 0; i < children.size(); i++) {
Element child = children.get(i);
String name = child.findNiftyControl("player" + i + "TextField", TextField.class).getDisplayedText();
if (child.findElementById("player" + i + "Label").getRenderer(TextRenderer.class).getOriginalText().equals("AI:")) {
System.err.println("AI not implemented yet. " + name + " excluded from Players.");
continue;
}
Color colorNifty = screen.findElementById("color" + i).getRenderer(PanelRenderer.class).getBackgroundColor();
org.newdawn.slick.Color colorSlick = new org.newdawn.slick.Color(colorNifty.getRed(), colorNifty.getGreen(), colorNifty.getBlue(), colorNifty.getAlpha());
int team = Integer.parseInt(screen.findNiftyControl("team" + i, Button.class).getText().substring(5))-1;
players.add(new Player(name, colorSlick, team));
}
Player[] player = new Player[players.size()];
player = players.toArray(player);
NiftyMenu.startGame(new Controller(MapList.getInstance().getMap(mapName), player, "Conquest"));
}
示例5: connect
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
public void connect() {
String username =
screen.findNiftyControl("username_text", TextField.class)
.getDisplayedText();
if (username.trim().length() == 0) {
setStatusText("Username is invalid");
return;
}
int port = Integer.parseInt(screen.findNiftyControl("server_port",
TextField.class).getDisplayedText());
String address = screen.findNiftyControl("server_ip",
TextField.class).getDisplayedText();
setStatusText("Connecting... " + username);
ClientMain clientMain = (ClientMain) Globals.app;
clientMain.connect(username, address, port);
}
示例6: applyGraphicsSettings
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
public void applyGraphicsSettings() {
TextField freeCameraSpeedField = nifty.getCurrentScreen()
.findNiftyControl("free_camera_speed", TextField.class);
String freeCameraSpeedString = freeCameraSpeedField.getDisplayedText();
try {
float freeCamSpeed = Integer.parseInt(freeCameraSpeedString);
if (freeCamSpeed > 0f) {
ClientSettings.setFreeCameraSpeed(freeCamSpeed);
}
} catch (NumberFormatException e) {
// TODO: Show error message
}
try {
appSettings.save(ClientMain.PREFERENCES_KEY);
} catch (BackingStoreException ex) {
Logger.getLogger(ClientSettings.class.getName()).log(Level.SEVERE,
"Failed to save graphic settings", ex);
}
}
示例7: bind
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
try {
if (screen.getScreenId().equals("start")) {
molField = screen.findNiftyControl("molecule", TextField.class);
molField.setText(getHistoryMolecule());
}
} catch (Exception ex) {
logger.log(Level.SEVERE, null, ex);
}
}
示例8: onStartScreen
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
@Override
public void onStartScreen() {
TextField email = screen.findNiftyControl("emailField", TextField.class);
email.setText(SettingsState.getSingleton().username);
//email.setText("");
if (email.getText().length() > 0) {
screen.getFocusHandler().setKeyFocus(screen.findNiftyControl("passwordField", TextField.class).getElement());
}
TextField password = screen.findNiftyControl("passwordField", TextField.class);
//password.setText("");
}
示例9: selectGame
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
public void selectGame() {
ListBox listbox = screen.findNiftyControl("lb_games", ListBox.class);
if (listbox.getSelection().isEmpty()) {
return;
}
Game selection = (Game) listbox.getSelection().get(0);
screen.findNiftyControl("server_ip", TextField.class)
.setText(selection.address);
screen.findNiftyControl("server_port", TextField.class)
.setText("" + selection.port);
closeGameList();
}
示例10: bind
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
public void bind(Nifty nifty, Screen screen) {
this.nifty = nifty;
this.screen = screen;
TextField freeCameraSpeedTextField = screen
.findNiftyControl("free_camera_speed", TextField.class);
freeCameraSpeedTextField
.setText(String.valueOf((int) getFreeCameraSpeed()));
}
示例11: bind
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
@Override
public void bind(Nifty nifty, Screen screen) {
this.loginField = screen.findNiftyControl("login", TextField.class);
this.passField = screen.findNiftyControl("pass", TextField.class);
}
示例12: chatFocused
import de.lessvoid.nifty.controls.TextField; //导入依赖的package包/类
/**Returns whether the chat text area currently has focus
*
* @return true if the chat text area has focus, false otherwise
*/
public boolean chatFocused(){
TextField tf = nifty.getScreen("hud").findNiftyControl("chatText",TextField.class);
return tf.hasFocus();
}