当前位置: 首页>>代码示例>>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;未经允许,请勿转载。