當前位置: 首頁>>代碼示例>>Java>>正文


Java TextButton.setColor方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.TextButton.setColor方法的典型用法代碼示例。如果您正苦於以下問題:Java TextButton.setColor方法的具體用法?Java TextButton.setColor怎麽用?Java TextButton.setColor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.TextButton的用法示例。


在下文中一共展示了TextButton.setColor方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addButtons

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
private void addButtons() {
    buttonTable = new Table();
    buttonTable.bottom();
    buttonTable.setFillParent(true);

    singlePlayer = new TextButton("\n  Single Player  \n", game.getSkin());
    multiPlayer = new TextButton("\n  Multi Player  \n", game.getSkin());
    achievements = new TextButton("\n  Achievements  \n", game.getSkin());
    sign = new TextButton(game.getPlayServices().isSignedIn() ?  "  Sign Out  " : "  Sign In  ", game.getSkin());
    sign.setColor(game.SECONDARY_COLOR);

    buttonTable.add(singlePlayer).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(multiPlayer).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(achievements).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(sign).center().padBottom(40);

    stage.addActor(buttonTable);
}
 
開發者ID:antonioalmeida,項目名稱:retro-reversi,代碼行數:22,代碼來源:MainMenuView.java

示例2: addOptionsButtons

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
private void addOptionsButtons() {
    buttonTable = new Table();
    buttonTable.bottom();
    buttonTable.setFillParent(true);

    localGameButton = new TextButton("\n  Local  \n", game.getSkin());
    onlineGameButton = new TextButton("\n    Online    \n", game.getSkin());
    checkGamesButton = new TextButton("\n  Check Games  \n", game.getSkin());
    backButton = new TextButton("Back", game.getSkin());

    buttonTable.add(localGameButton).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(onlineGameButton).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(checkGamesButton).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(backButton).center().padBottom(40);
    backButton.setColor(Reversi.SECONDARY_COLOR);

    stage.addActor(buttonTable);
}
 
開發者ID:antonioalmeida,項目名稱:retro-reversi,代碼行數:22,代碼來源:MultiplayerMenuView.java

示例3: addChoiceButtons

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
private void addChoiceButtons() {
    randomAIButton = new TextButton("\n  Easy  \n", game.getSkin());
    immediateAIButton = new TextButton("\n  Medium  \n", game.getSkin());
    calculatedAIButton = new TextButton("\n  Hard  \n", game.getSkin());
    backButton = new TextButton(" Back ", game.getSkin());
    backButton.setTransform(true);
    backButton.setColor(Reversi.SECONDARY_COLOR);

    buttonTable.add(randomAIButton).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(immediateAIButton).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(calculatedAIButton).center().padBottom(40);
    buttonTable.row();
    buttonTable.add(backButton).center().padBottom(40);

    stage.addActor(buttonTable);
}
 
開發者ID:antonioalmeida,項目名稱:retro-reversi,代碼行數:19,代碼來源:DifficultyMenuView.java

示例4: checkUI

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
public void checkUI(TextButton ui, String text, int gold){
if(player.gold >= gold)
{
    ui.setColor(defaultColor);
    ui.setText(text + " ($" + gold + ")");
}
else
{
    ui.setColor(Color.RED);
    ui.setText(text + " ($" + gold + ") - Not enough $");
}
pack();
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:14,代碼來源:BaseGUI.java

示例5: initElements

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
protected void initElements() {
    blackIcon = new Image(game.getAssetManager().get("black.png", Texture.class));
    whiteIcon = new Image(game.getAssetManager().get("white.png", Texture.class));
    paddle1 = new Image(game.getAssetManager().get("paddle.png", Texture.class));
    paddle2 = new Image(game.getAssetManager().get("paddle.png", Texture.class));
    score1 = new Label("02", game.getSkin());
    score2 = new Label("02", game.getSkin());
    board = new BoardView(presenter);
    back = new TextButton("Back", game.getSkin());
    back.setColor(Reversi.SECONDARY_COLOR);
    restart = new TextButton(" Restart ", game.getSkin());
    mainMenu = new TextButton(" Main Menu", game.getSkin());
    winner = new Label("", game.getSkin());
}
 
開發者ID:antonioalmeida,項目名稱:retro-reversi,代碼行數:15,代碼來源:GameStage.java

示例6: ChoosePlayerWindow

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
public ChoosePlayerWindow(String title, Skin skin, ArrayList<Player> opponents) {
    super(title, skin);
    
    // create content table for buttons
    final Table buttonTable = new Table(skin);
    
    // set width and height
    width = opponents.size() * 100 + (opponents.size() + 1) * 10;
    height = 1f / 5f * Gdx.graphics.getHeight();
    setWidth(width);
    setHeight(height);
    
    // create button with listener for each opponent player
    for (Player opponent : opponents) {
        TextButton playerButton = new TextButton(opponent.getAccount().getUsername(), skin);
        switch (opponent.getColor()) {
        case BLUE:
            playerButton.setColor(Color.BLUE);
            break;
        case ORANGE:
            playerButton.setColor(Color.ORANGE);
            break;
        case RED:
            playerButton.setColor(Color.RED);
            break;
        case WHITE:
            playerButton.setColor(Color.WHITE);
            break;
        case YELLOW:
            playerButton.setColor(Color.YELLOW);
            break;
        default:
            break;
        }
        
        playerButton.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                if (choosePlayerListener != null) {
                    choosePlayerListener.onPlayerChoosed(opponent);
                    remove();
                } 
            }
        });
        
        buttonTable.add(playerButton).padLeft(5).padRight(5).padTop(10).padBottom(10).size(90, height - 40);
    }
    
    add(buttonTable);
    
    // set position on screen
    setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
    
    // enable moving the window
    setMovable(true);
}
 
開發者ID:teobaranga,項目名稱:Catan,代碼行數:57,代碼來源:ChoosePlayerWindow.java

示例7: playerProgressWindow

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
public playerProgressWindow(String title, Skin skin, ArrayList<Player> opponents) {
    super(title, skin);

    // create content table for buttons
    final Table buttonTable = new Table(skin);

    // set width and height
    width = opponents.size() * 100 + (opponents.size() + 1) * 10;
    height = 1f / 5f * Gdx.graphics.getHeight();
    setWidth(width);
    setHeight(height);

    // create button with listener for each opponent player
    for (Player opponent : opponents) {
        TextButton playerButton = new TextButton(opponent.getAccount().getUsername(), skin);
        switch (opponent.getColor()) {
            case BLUE:
                playerButton.setColor(Color.BLUE);
                break;
            case ORANGE:
                playerButton.setColor(Color.ORANGE);
                break;
            case RED:
                playerButton.setColor(Color.RED);
                break;
            case WHITE:
                playerButton.setColor(Color.WHITE);
                break;
            case YELLOW:
                playerButton.setColor(Color.YELLOW);
                break;
            default:
                break;
        }

        playerButton.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                if (choosePlayerListener != null) {
                    choosePlayerListener.onPlayerChoosed(opponent);
                    remove();
                }
            }
        });

        buttonTable.add(playerButton).padLeft(5).padRight(5).padTop(10).padBottom(10).size(90, height - 40);
    }

    add(buttonTable);

    // set position on screen
    setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);

    // enable moving the window
    setMovable(true);
}
 
開發者ID:teobaranga,項目名稱:Catan,代碼行數:57,代碼來源:playerProgressWindow.java

示例8: ChooseProgressCardKindWindow

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
public ChooseProgressCardKindWindow(String title, List<ProgressCardKind> kindsToChooseFrom, Skin skin) {
	super(title, skin);
	
	// create content table for buttons
       final Table buttonTable = new Table(skin);
       
       // set width and height
       width = 330;
       height = 1f / 5f * Gdx.graphics.getHeight();
       setWidth(width);
       setHeight(height);
       
       // create button with listener for each kind
       for (ProgressCardKind kind : kindsToChooseFrom) {
           TextButton kindButton = new TextButton(kind.toString().toLowerCase(), skin);
           switch (kind) {
		case POLITICS:
			kindButton.setColor(Color.BLUE);
			break;
		case SCIENCE:
			kindButton.setColor(Color.GREEN);
			break;
		case TRADE:
			kindButton.setColor(Color.ORANGE);
			break;
		default:
			break;
           }
           
           kindButton.addListener(new ChangeListener() {
               @Override
               public void changed(ChangeEvent event, Actor actor) {
                   if (chooseKindListener != null) {
                   	chooseKindListener.onKindChosen(kind);
                       remove();
                   } 
               }
           });
           
           buttonTable.add(kindButton).padLeft(5).padRight(5).padTop(10).padBottom(10).size(90, height - 40);
       }
       
       add(buttonTable);
       
       // set position on screen
       setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
       
       // enable moving the window
       setMovable(true);
}
 
開發者ID:teobaranga,項目名稱:Catan,代碼行數:51,代碼來源:ChooseProgressCardKindWindow.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.TextButton.setColor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。