本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.TextButton.setSize方法的典型用法代碼示例。如果您正苦於以下問題:Java TextButton.setSize方法的具體用法?Java TextButton.setSize怎麽用?Java TextButton.setSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.TextButton
的用法示例。
在下文中一共展示了TextButton.setSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: init
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
private void init() {
// Make the window around 3/4 of the screen
setSize(width, height);
// Position window in the middle
setPosition(Gdx.graphics.getWidth() / 2 - getWidth() / 2, Gdx.graphics.getHeight() / 2 - getHeight() / 2);
// Center title
getTitleLabel().setAlignment(Align.center);
// Create the close button
if (getTitleLabel().getText().length != 0) {
closeButton = new TextButton("X", getSkin());
closeButton.setSize(20, 20);
closeButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
closeButton.setChecked(false);
close();
}
});
getTitleTable().addActor(closeButton);
closeButton.setPosition(getWidth() - closeButton.getWidth() - 5, 0);
}
getTitleTable().getCells().get(0).expandY().fillY();
setMovable(false);
setModal(true);
row();
}
示例2: PlayGroup
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //導入方法依賴的package包/類
public PlayGroup(Client client) {
play = new TextButton("Play", Assets.SKIN);
play.setSize(200, 40);
play.setPosition((Gdx.graphics.getWidth() - play.getWidth()) / 2, Gdx.graphics.getHeight() / 8);
port = new NumberField(null, Assets.SKIN);
port.setPosition(play.getX(), play.getY() + port.getHeight() * 1.1f);
port.setBounds(port.getX(), port.getY(), play.getWidth(), play.getHeight());
host = new TextField(null, Assets.SKIN);
host.setSize(200, 40);
host.setPosition(play.getX(), port.getY() + host.getHeight() * 1.1f);
hostLabel = new ConquestLabel("Host:", host.getX() - 75, host.getY() - 5, 50, 50);
portLabel = new ConquestLabel("Port:", hostLabel.getX(), port.getY() - 5, 50, 50);
server = new ConquestLabel("Failed to connect.", play.getX(), host.getY() + 75, 200, 1);
server.setVisible(false);
play.addCaptureListener(new ClickListener() {
public void clicked(InputEvent event, float x, float y) {
try {
client.connect(host.getText(), port.getValue());
} catch (IOException io) {
server.setVisible(true);
Timer.schedule(new Timer.Task() {
@Override
public void run() {
server.setVisible(false);
}
}, 1);
}
}
});
addActor(play);
addActor(port);
addActor(portLabel);
addActor(host);
addActor(hostLabel);
addActor(server);
}