本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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;
}
示例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();
}
}
示例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);
}
示例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());
}
示例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);
}
示例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... ");
}
示例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);
}
示例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();
}
示例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);
}