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


Java Label类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Label的典型用法代码示例。如果您正苦于以下问题:Java Label类的具体用法?Java Label怎么用?Java Label使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Label类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Label类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updatePlayerSlot

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
private Table updatePlayerSlot(Table t, Player p) {
	t.clear();
	if (p == null) {
		t.add().width(25);
		t.add(new Label(" -- Frei -- ", skin)).width(350);
		t.add().width(50);
	} else {
		t.add().width(25); // Icon
		t.add(new Label(p.getName() + " " + p.getSurname() + " ", skin))
				.width(350);
		t.add().width(25); // Bereit
		t.add().width(25); // Kicken
	}

	return t;
}
 
开发者ID:eskalon,项目名称:ProjektGG,代码行数:17,代码来源:LobbyScreen.java

示例2: setupRedDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
private Table setupRedDiceOption(int diceNumber) {
    Table redDiceOption = new Table();
    redDiceOption.setBackground(redBackground);
    
    redDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    redDiceOption.setTouchable(Touchable.enabled); 
    redDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenRedDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenRedDice = 0;
                enableAllTouchablesRed();
            } else {
                System.out.println("choose " + diceNumber);
                chosenRedDice = diceNumber;
                disableAllTouchablesRed();
                redDiceOption.setTouchable(Touchable.enabled);
                redDiceOption.setBackground(redBackground);
            }
        }
    });
    
    return redDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例3: setupYellowDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
private Table setupYellowDiceOption(int diceNumber) {
    Table yellowDiceOption = new Table();
    yellowDiceOption.setBackground(yellowBackground);
    
    yellowDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    yellowDiceOption.setTouchable(Touchable.enabled); 
    yellowDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenYellowDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenYellowDice = 0;
                enableAllTouchablesYellow();
            } else {
                System.out.println("choose " + diceNumber);
                chosenYellowDice = diceNumber;
                disableAllTouchablesYellow();
                yellowDiceOption.setTouchable(Touchable.enabled);
                yellowDiceOption.setBackground(yellowBackground);
            }
        }
    });
    
    return yellowDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例4: initWinStage

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
private void initWinStage() {
	setViewport(new ScreenViewport(getCamera()));
	getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	getViewport().apply(true);
	
	Label youWinLabel = new Label("You Won!" , Assets._skin , "fontVeraBd24" , "white");
	playAgainBtn = new TextButton("Play Again", Assets._skin , "menu");
	mainMenuBtn = new TextButton("Main Menu", Assets._skin , "menu");
	Table container = new Table(Assets._skin);
	youWinLabel.setColor(Color.GREEN);
	container.add(youWinLabel).spaceBottom(100).row();
	container.add(playAgainBtn).align(Align.left).spaceBottom(20).row();
	container.add(mainMenuBtn).align(Align.left);
	container.setSize(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
	container.setFillParent(true);
	addActor(container);
}
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:18,代码来源:WinStage.java

示例5: createSkins

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
/**
 * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized.
 * It also adds Listeners to the Skins' Buttons.
 *
 * @param table Table where the Skins' Labels and Buttons will be organized.
 */
private void createSkins(Table table) {
    for (int i = 0; i < game.getNumSkins(); ++i) {

        //Adding Buttons and Labels to the Arrays
        skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class)))));
        skinLabels.add(new Label("Current", skin1));

        final int j = i; //Needed for Listener initialization
        skinButtons.get(i).addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                setCurrentLabel(j);
            }
        });

        table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE);
    }
    table.row();

    for (int i = 0; i < game.getNumSkins(); ++i)
        table.add(skinLabels.get(i));

    initializeCurrentSkin();
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:31,代码来源:CustomizeMenuScreen.java

示例6: initHUD

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
/**
 * Function used to initialize all the elements of the HUD and add the respective Listeners.
 */
private void initHUD() {
    Table hudTable = new Table();
    hudTable.setFillParent(true);

    Button pauseButton = new Button(new TextureRegionDrawable(
            new TextureRegion(game.getAssetManager().get("pause.png", Texture.class))));

    scoreText = new Label("0:00", skin);
    scoreText.setFontScale(FONT_SCALE, FONT_SCALE);

    pauseButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            model.togglePause();
        }
    });

    hudTable.top();
    hudTable.add(scoreText).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).expandX()
            .left().fill().padLeft(HORIZONTAL_PAD).padTop(VERTICAL_PAD);
    hudTable.add(pauseButton).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).fill()
            .padRight(HORIZONTAL_PAD).padTop(VERTICAL_PAD);

    this.addActor(hudTable);
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:29,代码来源:HudMenu.java

示例7: UpdateInvisibleCells

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
public void UpdateInvisibleCells()
{
    for(int i =0; i< labelArrayList.size();i++){
        Label label = labelArrayList.get(i);
        if(!label.isVisible()){
            Random random = new Random();
            int rand = random.nextInt(5);
            CalculateColorText calculateColorText = new CalculateColorText(rand).invoke();
            Color color = calculateColorText.getColor();
            String text = calculateColorText.getText();
            Label.LabelStyle labelStyle = new Label.LabelStyle();
            labelStyle.font = font50;
            labelStyle.background = uiSkin.newDrawable("white", color);
            label.setText(text);
            label.setStyle(labelStyle);
            label.setVisible(true);
        }
    }
}
 
开发者ID:luarca84,项目名称:Caramelos,代码行数:20,代码来源:CaramelosScreen.java

示例8: StageLoad

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
/**
 * Loading stage
 * @param doLoad should resources be loaded? It acts as a splash screen otherwise.
 */
public StageLoad(boolean doLoad) {
	this.doLoad = doLoad;
	// Create icon
	icon = new Image(new Texture("image/icon-512.png"));
	int size = Gdx.graphics.getHeight();
	if (Gdx.graphics.getHeight() > Gdx.graphics.getWidth())
		size = Gdx.graphics.getWidth();
	icon.setSize(size, size);
	icon.setPosition(Gdx.graphics.getWidth() / 2 - size / 2,
			Gdx.graphics.getHeight() / 2 - icon.getHeight() / 2);
	addActor(icon);
	// Loading Text
	Label.LabelStyle loadingStyle = new Label.LabelStyle();
	loadingStyle.font = new BitmapFont(Gdx.files.internal("font/collvetica.fnt"));
	loadingStyle.font.getData().setScale(Gdx.graphics.getHeight() * 2 / 720);
	loading = new Label("DRC Sim", loadingStyle);
	loading.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight() * .2f);
	loading.setAlignment(Align.center);
	addActor(loading);
}
 
开发者ID:rolandoislas,项目名称:drc-sim-client,代码行数:25,代码来源:StageLoad.java

示例9: GameDialog

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
public GameDialog(Skin skin) {
super("", skin);

waveLevel = new Label("", skin);
monsHP = new Label("", skin);
monsBonus = new Label("", skin);
monsSpeed = new Label("", skin);
monsNumber = new Label("", skin);
btnOK = new TextButton("Okay, Let them come!", skin);
btnOK.addListener(new ChangeListener() {

    @Override
    public void changed(ChangeEvent event, Actor actor) {
	// TODO Auto-generated method stub
	setVisible(false);

    }
});
setTitle(" There are more monsters are coming to you... ");
   }
 
开发者ID:game-libgdx-unity,项目名称:GDX-Engine,代码行数:21,代码来源:GameDialog.java

示例10: HudScene

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
public HudScene(SpriteBatch batch, ShapeRenderer shapeRenderer, ArcRenderer arcRenderer) {
    this.batch = batch;
    stage = new Stage();

    VisUI.load();

    Table table = new Table();
    table.top();
    table.setFillParent(true);

    scoreLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
    setScore(score);
    balanceLabel = new Label("", new Label.LabelStyle(new BitmapFont(), Color.VIOLET));
    setBalance(balance);

    table.add(scoreLabel).align(Align.left).expandX();
    table.add(balanceLabel).align(Align.right).expandX();

    stage.addActor(table);


    ringButton = new RingButton(shapeRenderer, arcRenderer);
    ringButton.setBounds(10, 10, 100, 100);
    stage.addActor(ringButton);
}
 
开发者ID:MiniDigger,项目名称:projecttd,代码行数:26,代码来源:HudScene.java

示例11: ScrollInventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
public ScrollInventoryActor(Inventory inventory, int slots) {
	defaults().space(4f);

	add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
	row();

	inner = new Table();
	inner.defaults().space(4f);
	for (int i = 0; i < inventory.itemStacks.length; i++) {
		SlotActor slotActor = new SlotActor(inventory, i);
		inner.add(slotActor);

		if ((i + 1) % inventory.width == 0) {
			inner.row();
		}
	}
	inner.pack();

	scrollPane = new ScrollPane(inner);
	scrollPane.setScrollingDisabled(true, false);
	add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
	row();
	pack();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:25,代码来源:ScrollInventoryActor.java

示例12: InventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
public InventoryActor(Inventory inventory) {
	defaults().space(4f);

	add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE))).colspan(inventory.width);
	row();

	SlotActor slotActor;
	for (int i = 0; i < inventory.itemStacks.length; i++) {
		slotActor = new SlotActor(inventory, i);
		add(slotActor);

		if ((i + 1) % inventory.width == 0) {
			row();
		}
	}

	pack();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:19,代码来源:InventoryActor.java

示例13: SingleplayerSaveDeleteMenu

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
public SingleplayerSaveDeleteMenu(final Save save) {
	title = new Label(Localization.get("menu.singleplayer.delete.title"),
			skin.get("title", Label.LabelStyle.class));
	text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
	delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
	back = MenuTools.getBackButton(this);

	text.setAlignment(Align.center);

	delete.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			ClientSaveManager.deleteSave(save);
			Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
			if (!(prev instanceof SingleplayerSavesMenu))
				return;
			((SingleplayerSavesMenu) prev).updateSavesList();
			Adapter.setMenu(prev);
		}
	});

	stage.addActor(title);
	stage.addActor(text);
	stage.addActor(delete);
	stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:27,代码来源:SingleplayerSaveDeleteMenu.java

示例14: MultiplayerConnectMenu

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
public MultiplayerConnectMenu() {
  super();
  title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
  address = new TextField("", skin);
  address.setMessageText(Localization.get("menu.multiplayer.address"));
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
  back = MenuTools.getBackButton(this);

  connect.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
    }
  });

  stage.addActor(title);
  stage.addActor(address);
  stage.addActor(port);
  stage.addActor(connect);
  stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:25,代码来源:MultiplayerConnectMenu.java

示例15: addChangeFaction

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入依赖的package包/类
private void addChangeFaction(){
    groupChangeFaction = new Group();
    Image background = new Image(new TextureRegion(manager.getAssetsSettings().getTexture(NameFiles.extensionImgBackground)));
    background.setSize(Width - Width * 0.03f, Height * 0.1f);
    background.setPosition(Width / 2 - background.getWidth() / 2, Height * 0.3f);
    groupChangeFaction.addActor(background);
    Label labelFac = new Label("Change Faction",new Label.LabelStyle(Font.getFont((int)(Height*0.025f)),Color.WHITE));
    labelFac.setPosition(background.getX()+background.getWidth()*0.05f,background.getY()+background.getHeight()/2-labelFac.getHeight()/2);
    labelFac.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            manager.loadAssetsChoiceFaction();
            gameManager.setScreen(new ScreenCircleLoading(gameManager,new ScreenChoiceFaction(gameManager),manager.getAssetsChoiceFaction()));
        }
    });
    groupChangeFaction.addActor(labelFac);
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:18,代码来源:ScreenSetting.java


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