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


Java TextButton類代碼示例

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


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

示例1: createToolTip

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
private void createToolTip()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	labelToolTip = new TextButton("TEST", skin);
	labelToolTip.setX(5);
	labelToolTip.setY(5);
	labelToolTip.setWidth(125);
	labelToolTip.setVisible(false);
	labelToolTip.getLabel().setWrap(true);
	labelToolTip.setHeight(labelToolTip.getLabel().getHeight());
	group.addActor(labelToolTip);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:24,代碼來源:LudumDare38.java

示例2: createResetButton

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
private void createResetButton()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	btnReset = new TextButton("RESET", skin);
	btnReset.setX(5);
	btnReset.setY(Gdx.graphics.getHeight() - 25);
	btnReset.setWidth(60);
	btnReset.setVisible(true);
	group.addActor(btnReset);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:22,代碼來源:LudumDare38.java

示例3: createUndoButton

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
private void createUndoButton()
{
	Skin skin = new Skin();
	Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
	pixmap.setColor(Color.WHITE);
	pixmap.fill();
	skin.add("white", new Texture(pixmap));
	skin.add("default", new BitmapFont());

	TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
	textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
	textButtonStyle.font = skin.getFont("default");
	skin.add("default", textButtonStyle);

	btnUndo = new TextButton("UNDO", skin);
	btnUndo.setX(70);
	btnUndo.setY(Gdx.graphics.getHeight() - 25);
	btnUndo.setWidth(60);
	btnUndo.setVisible(true);
	group.addActor(btnUndo);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:22,代碼來源:LudumDare38.java

示例4: ObjectiveDialog

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
public ObjectiveDialog(Skin skin, Hexpert hexpert) {
    super(hexpert, skin);
    getBackground().setMinWidth(1000);

    final TextButton textButtonOK = new TextButton(hexpert.i18NBundle.get("ok"), skin);

    textButtonOK.addListener(new ClickListener(){

        @Override
        public void clicked(InputEvent event, float x, float y) {
            textButtonOK.setChecked(false);
        }
    });
    setObject(textButtonOK, null);
    getButtonTable().add(textButtonOK);

    getContentTable().defaults().pad(5, 0, 5, 15);
    getContentTable().top();
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:20,代碼來源:ObjectiveDialog.java

示例5: createAchievementButton

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
/**
 * Adds the Achievements Button to the Networking Menu.
 *
 * @param table The table to where the Achievements button will be added.
 */
private void createAchievementButton(Table table) {
    TextButton achievementsButton = new TextButton("Achievements", skin1);

    achievementsButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            gameServices.showAchievements();

        }
    });
    table.add(achievementsButton).size(BUTTON_WIDTH, DEFAULT_BUTTON_SIZE).pad(BUTTON_EDGE).row();
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:18,代碼來源:NetworkingMenuScreen.java

示例6: createSignInBtn

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
/**
 * Adds the Sign In / Sign Out Button to the Networking Menu.
 *
 * @param table The table to where the button will be added.
 */
private void createSignInBtn(Table table) {
    final TextButton signInButton = new TextButton(
            gameServices.isSignedIn() ? "Sign Out" : "Sign In!", skin1);

    signInButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (gameServices.isSignedIn()) {
                gameServices.signOut();
                signInButton.setText("Sign In!");
            } else {
                gameServices.signIn();
                signInButton.setText("Sign Out");
            }
        }
    });
    table.add(signInButton).size(BUTTON_WIDTH, DEFAULT_BUTTON_SIZE).pad(BUTTON_EDGE).row();
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:24,代碼來源:NetworkingMenuScreen.java

示例7: addBackBtn

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
protected TextButton addBackBtn(boolean style) {
    TextButton back = new TextButton("Back", (style ? skin2 : skin1));

    back.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            game.setScreen(new NetworkingMenuScreen(game));
        }
    });

    return back;
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:17,代碼來源:LeaderboardMenuScreen.java

示例8: createLevelButtons

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
/**
 * Function used to create the Level Buttons and associate them to a given table, organized.
 * It also adds Listeners to the Level buttons.
 *
 * @param table Table where the Level Buttons will be organized.
 */
private void createLevelButtons(Table table) {

    for (int i = 1; i <= game.getNumMaps(); ++i) {
        levelButtons.add(new TextButton(String.valueOf(i), skin2));

        table.add(levelButtons.get(i - 1)).size(BUTTON_SIDE, BUTTON_SIDE).pad(BUTTON_EDGE);

        //Adding the button's listener
        final int j = (i - 1);
        addLevelListener(j);

        if ((i % BUTTONS_PER_LINE) == 0)
            table.row();
    }
}
 
開發者ID:AndreFCruz,項目名稱:feup-lpoo-armadillo,代碼行數:22,代碼來源:LevelMenuScreen.java

示例9: 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

示例10: addTab

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
public void addTab(String tabTitle, final ITabContent tabContent,
		Skin skin) {

	TextButton button = new TextButton(tabTitle, skin);
	button.align(Align.left);
	//button.setFillParent(true);
	button.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			tabContent.setContent(content);
			content.pack();
			setWidth(preferedContentWidth);
			setHeight(preferedContentHeight);
			
		}
	});
	
	tabHeaders.add(button);
	contents.add(tabContent);
	
	preferedContentWidth = Math.max(preferedContentWidth, tabContent.getWidth());
	preferedContentHeight = Math.max(preferedContentHeight, tabContent.getHeight() + tabHeaders.get(0).getHeight());
}
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:24,代碼來源:TabPane.java

示例11: onBuild

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
@Override
   protected void onBuild(Skin skin) {
btnAddGun = new TextButton("Add Gun Lv.1 ($" + GameSpecs.gun_cost_first
	+ ")", skin);
row().fill().expandX();
add(btnAddGun).expandX();
btnAddCanon = new TextButton("Add Canon Lv.1 ($"
	+ GameSpecs.canon_cost_first + ")", skin);
row().fill().expandX();
add(btnAddCanon).expandX();
btnAddSlower = new TextButton("Add Slower Lv.1 ($"
	+ GameSpecs.slower_cost_first + ")", skin);
row().fill().expandX();
add(btnAddSlower).expandX();
super.onBuild(skin);
   }
 
開發者ID:game-libgdx-unity,項目名稱:GDX-Engine,代碼行數:17,代碼來源:BuildWeaponGUI.java

示例12: GameDialog

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的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

示例13: MultiplayerConnectMenu

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的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

示例14: AddWindowButton

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
private void AddWindowButton(final UIElement window, String buttonText, Skin skin, Table table)
{
	final TextButton btn = new TextButton(buttonText, skin);

	btn.addListener(new ChangeListener()
	{
		@Override
		public void changed(ChangeEvent event, Actor actor)
		{
			if (window.isShowing())
				window.hide();
			else
				window.show();
		}
	});

	table.add(btn);
	table.row();
}
 
開發者ID:bp2008,項目名稱:blueirisviewer,代碼行數:20,代碼來源:MainOptionsWnd.java

示例15: LockedDialog

import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入依賴的package包/類
public LockedDialog(int currentGoals, int goalsNeeded, Hexpert hexpert, Skin skin) {
    super(hexpert, skin.get("gray", WindowStyle.class));
    getBackground().setMinWidth(1000);
    getBackground().setMinHeight(350);

    getContentTable().defaults().pad(25);

    TextButton.TextButtonStyle txtButtonStyle = skin.get("gray", TextButton.TextButtonStyle.class);

    Label label = new Label(hexpert.i18NBundle.format("locked_left", currentGoals, goalsNeeded), skin);
    getContentTable().add(label).top();

    final TextButton textButtonOK = new TextButton(hexpert.i18NBundle.get("ok"), txtButtonStyle);

    textButtonOK.addListener(new ClickListener() {

        @Override
        public void clicked(InputEvent event, float x, float y) {
            textButtonOK.setChecked(false);
        }
    });
    setObject(textButtonOK, null);
    getButtonTable().add(textButtonOK);
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:25,代碼來源:LockedDialog.java


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