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


Java TextField.setBackgroundColor方法代码示例

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


在下文中一共展示了TextField.setBackgroundColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
 
开发者ID:MichaelJ2,项目名称:big-buum-man,代码行数:23,代码来源:SaveScreen.java

示例2: set

import org.newdawn.slick.gui.TextField; //导入方法依赖的package包/类
void set(int typeID, GUI gui){
    this.typeID = typeID;
    this.gui = gui;

    gui.clear();

    gc = gui.gc;
    bgWidth = 600;
    bgHeight = 400;
    bgPosX = gc.getWidth()/2-bgWidth/2;
    bgPosY = gc.getHeight()/2-bgHeight/2;
    this.bg = new Rectangle(bgPosX, bgPosY, bgWidth, bgHeight);
    this.border = new Rectangle(gc.getWidth()/2-(bgWidth+5)/2, gc.getHeight()/2-(bgHeight+5)/2, bgWidth, bgHeight);

    si = items.get(typeID);
    cats = si.getCategories();

    int strHeight = fontSmall.getHeight("A"),
        titleHeight = fontTitle.getHeight("A"),
        x = bgPosX+10,
        y = bgPosY+titleHeight+15;
    for (String cat : cats){
        gui.drawText(cat, x, y, fontSmall, Color.white);
        y+=strHeight;
    }
    gui.drawText("X", bgPosX+bgWidth-20, bgPosY+5, fontSmall, Color.white);

    amount = new TextField(gc, fontSmall, 0, 0, 150, 40);
    amount.setBackgroundColor(new Color(0, 0, 0, 50));
    amount.setBorderColor(Color.transparent);
    amount.setTextColor(Color.white);
    amount.setMaxLength(253);
    amount.setFocus(true);
    amount.isAcceptingInput();

    closeChooseAmount();

    isSet = true;
}
 
开发者ID:Piratkopia13,项目名称:Pixel-Planet,代码行数:40,代码来源:Shop.java

示例3: 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);
	
}
 
开发者ID:Piratkopia13,项目名称:Pixel-Planet,代码行数:36,代码来源:Menu.java

示例4: 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);
}
 
开发者ID:MichaelJ2,项目名称:big-buum-man,代码行数:35,代码来源:NewMapScreen.java

示例5: 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();
	}
}
 
开发者ID:JavaJumperStudios,项目名称:Saboteur,代码行数:54,代码来源:SaboteurMenu.java


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