本文整理汇总了Java中org.newdawn.slick.gui.TextField.setText方法的典型用法代码示例。如果您正苦于以下问题:Java TextField.setText方法的具体用法?Java TextField.setText怎么用?Java TextField.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.newdawn.slick.gui.TextField
的用法示例。
在下文中一共展示了TextField.setText方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.newdawn.slick.gui.TextField; //导入方法依赖的package包/类
@Override
public void init(final GameContainer paramGameContainer, final StateBasedGame paramStateBasedGame) throws SlickException {
game = paramStateBasedGame;
font = Resources.INSTANCE.font;
textField = new TextField(paramGameContainer, font, 100, 540, 1720 , 140);
textField.setBackgroundColor(Color.white);
textField.setBorderColor(Color.black);
textField.setText(Map.INSTANCE.getMapName());
TITLE_WIDTH = font.getWidth(TITLE);
SAVE_WIDTH = font.getWidth(SAVE);
SAVE_HEIGHT = font.getHeight(SAVE);
BACK_WIDTH = font.getWidth(BACK);
BACK_HEIGHT = font.getHeight(BACK);
save = new Rectangle(430 - (SAVE_WIDTH / 2), 800, SAVE_WIDTH, SAVE_HEIGHT);
back = new Rectangle(1290 - (BACK_WIDTH / 2), 800, BACK_WIDTH, BACK_HEIGHT);
}
示例2: init
import org.newdawn.slick.gui.TextField; //导入方法依赖的package包/类
@Override
public void init(GameContainer gc, final StateBasedGame sbg) throws SlickException {
bg = new Image("res/bg.png");
logo = new Image("res/logo.png");
try {
awtFontTitle = Game.awtFontTitle.deriveFont(40f); // set font size
titleFont = new TrueTypeFont(awtFontTitle, true);
awtFont = Game.awtFont.deriveFont(30f); // set font size
font = new TrueTypeFont(awtFont, true);
} catch (Exception e) {
e.printStackTrace();
}
IPinput = new TextField(gc, font, 0, 0, 350, 50);
IPinput.setBackgroundColor(new Color(0, 0, 0, 50));
IPinput.setBorderColor(Color.transparent);
IPinput.setTextColor(Color.white);
IPinput.setMaxLength(253);
IPinput.setText(Game.prefs.get(Game.pref_lastip, ""));
IPinput.setCursorPos(IPinput.getText().length());
nameField = new TextField(gc, font, 0, 0, 350, 50);
nameField.setBackgroundColor(new Color(0, 0, 0, 50));
nameField.setBorderColor(Color.transparent);
nameField.setTextColor(Color.white);
nameField.setMaxLength(20);
nameField.setText(Game.prefs.get(Game.pref_playername, Game.default_username));
nameField.setCursorPos(nameField.getText().length());
// Net
Game.network = new Network(gc, sbg);
}
示例3: init
import org.newdawn.slick.gui.TextField; //导入方法依赖的package包/类
@Override
public void init(final GameContainer paramGameContainer, final StateBasedGame paramStateBasedGame) throws SlickException {
game = paramStateBasedGame;
font = Resources.INSTANCE.font;
font2 = paramGameContainer.getDefaultFont();
xField = new TextField(paramGameContainer, font2, 510, 540, 300 , 140);
xField.setBackgroundColor(Color.black);
xField.setBorderColor(Color.white);
xField.setText("22");
xField.setMaxLength(2);
yField = new TextField(paramGameContainer, font, 1060, 540, 300 , 140);
yField.setBackgroundColor(Color.black);
yField.setBorderColor(Color.white);
yField.setText("22");
yField.setMaxLength(2);
TITLE_X = font.getWidth(TITLE) / 2;
OK_X = font.getWidth(OK);
OK_Y = font.getHeight(OK);
BACK_X = font.getWidth(BACK);
BACK_Y = font.getHeight(BACK);
X_X = font.getWidth(X) / 2;
REASON_X = font.getWidth(reason) / 2;
ok = new Rectangle(1260 - (OK_X / 2), 800, OK_X, OK_Y);
back = new Rectangle(660 - (BACK_X / 2), 800, BACK_X, BACK_Y);
}
示例4: init
import org.newdawn.slick.gui.TextField; //导入方法依赖的package包/类
@Override
public void init(GameContainer container, StateBasedGame game) throws SlickException {
loadProperties();
// background = RessourceManager.loadImage("night.jpg");
connectButton = new Button(this, container, RessourceManager.loadImage("button.png"), 64, 160, () -> {
try {
SaboteurGame.instance.setUpConnection(ipTextField.getText(), 5000, pwTextField.getText(),
nameTextField.getText());
if (playMusic)
openingMenuMusic.fade(5000, 0, true);
StateManager.changeState(1, new FadeOutTransition(Color.black, 1000),
new FadeInTransition(Color.black, 1000));
} catch (Exception e) {
System.out.println("Verbindung zum Server konnte nicht hergestellt werden.");
e.printStackTrace();
}
});
connectButton.setText("Verbinden");
connectButton.setMouseDownImage(RessourceManager.loadImage("buttonShadow.png"));
exitButton =
new Button(this, container, RessourceManager.loadImage("button.png"), 1024, 512, () -> System.exit(0));
exitButton.setText("Spiel beenden");
exitButton.setSound(RessourceManager.loadSound("button.wav"));
ipTextField =
new TextField(container, new TrueTypeFont(new Font("Verdana", Font.BOLD, 16), false), 64, 64, 300, 25);
ipTextField.setTextColor(Color.black);
ipTextField.setBackgroundColor(Color.white);
ipTextField.setText("localhost");
pwTextField =
new TextField(container, new TrueTypeFont(new Font("Verdana", Font.BOLD, 16), false), 64, 96, 300, 25);
pwTextField.setTextColor(Color.black);
pwTextField.setBackgroundColor(Color.white);
pwTextField.setText("");
pwTextField.deactivate();
nameTextField =
new TextField(container, new TrueTypeFont(new Font("Verdana", Font.BOLD, 16), false), 64, 128, 300, 25);
nameTextField.setTextColor(Color.black);
nameTextField.setBackgroundColor(Color.white);
nameTextField.setText("");
nameTextField.setMaxLength(10);
if (playMusic) {
openingMenuMusic = new Music("res/music/Kool Kats.ogg");
openingMenuMusic.loop();
}
}