当前位置: 首页>>代码示例>>Java>>正文


Java Table类代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Table的典型用法代码示例。如果您正苦于以下问题:Java Table类的具体用法?Java Table怎么用?Java Table使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Table类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了Table类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ObjectEditor

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
public ObjectEditor(Scene scene, String objectName) {
    this.scene = scene;

    top = new Table();
    top.add(new VisLabel(objectName)).expandX().pad(0, 20, 0, 20);

    VisTextButton deleteObject = new VisTextButton("Delete");
    deleteObject.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            hasDeleteBeenPressed = true;
            delete();
        }
    });
    top.add(deleteObject).pad(0, 20, 0, 20);

    add(top).padTop(80).colspan(4).row();

    bottom = new Table();
}
 
开发者ID:ZKasica,项目名称:Planet-Generator,代码行数:21,代码来源:ObjectEditor.java

示例2: initialize

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
@Override
protected void initialize() {
    Table topButtonBar = new Table();
    topButtonBar.setFillParent(true);

    VisTextButton showEditorButton = new VisTextButton("Show Editor");
    showEditorButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            showEditorClicked();
        }
    });
    topButtonBar.top().left().add(showEditorButton).pad(7);

    Table bottomButtonBar = new Table();
    bottomButtonBar.setFillParent(true);

    stage.addActor(topButtonBar);
}
 
开发者ID:ZKasica,项目名称:Planet-Generator,代码行数:20,代码来源:SceneUI.java

示例3: setupRedDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
private Table setupRedDiceOption(int diceNumber) {
    Table redDiceOption = new Table();
    redDiceOption.setBackground(redBackground);
    
    redDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    redDiceOption.setTouchable(Touchable.enabled); 
    redDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenRedDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenRedDice = 0;
                enableAllTouchablesRed();
            } else {
                System.out.println("choose " + diceNumber);
                chosenRedDice = diceNumber;
                disableAllTouchablesRed();
                redDiceOption.setTouchable(Touchable.enabled);
                redDiceOption.setBackground(redBackground);
            }
        }
    });
    
    return redDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例4: setupYellowDiceOption

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
private Table setupYellowDiceOption(int diceNumber) {
    Table yellowDiceOption = new Table();
    yellowDiceOption.setBackground(yellowBackground);
    
    yellowDiceOption.add(new Label("" + diceNumber, CatanGame.skin));
    
    yellowDiceOption.setTouchable(Touchable.enabled); 
    yellowDiceOption.addListener(new ClickListener(){
        @Override
        public void clicked(InputEvent event, float x, float y) {
            if (chosenYellowDice == diceNumber) {
                System.out.println("discard choice of " + diceNumber);
                chosenYellowDice = 0;
                enableAllTouchablesYellow();
            } else {
                System.out.println("choose " + diceNumber);
                chosenYellowDice = diceNumber;
                disableAllTouchablesYellow();
                yellowDiceOption.setTouchable(Touchable.enabled);
                yellowDiceOption.setBackground(yellowBackground);
            }
        }
    });
    
    return yellowDiceOption;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:27,代码来源:ChooseDiceResultWindow.java

示例5: createSkins

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
/**
 * Function used to create the Skins' Buttons and Labels and associate them to a given table, organized.
 * It also adds Listeners to the Skins' Buttons.
 *
 * @param table Table where the Skins' Labels and Buttons will be organized.
 */
private void createSkins(Table table) {
    for (int i = 0; i < game.getNumSkins(); ++i) {

        //Adding Buttons and Labels to the Arrays
        skinButtons.add(new Button(new TextureRegionDrawable(new TextureRegion(game.getAssetManager().get("big_skins/skin" + (i < 10 ? "0" : "") + i + ".png", Texture.class)))));
        skinLabels.add(new Label("Current", skin1));

        final int j = i; //Needed for Listener initialization
        skinButtons.get(i).addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                setCurrentLabel(j);
            }
        });

        table.add(skinButtons.get(i)).size(BUTTON_SIZE, BUTTON_SIZE).pad(IMAGE_EDGE);
    }
    table.row();

    for (int i = 0; i < game.getNumSkins(); ++i)
        table.add(skinLabels.get(i));

    initializeCurrentSkin();
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:31,代码来源:CustomizeMenuScreen.java

示例6: show

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void show() {
    super.show();

    //Table containing all the possibles Ball appearances
    Table skins = new Table();

    //Table containing the screen elements that shall not move with the scroller
    Table staticElements = new Table();
    staticElements.setFillParent(true);

    createSkins(skins);
    createStaticElements(staticElements, skins);

    stage.addActor(staticElements);
    Gdx.input.setInputProcessor(stage);
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:21,代码来源:CustomizeMenuScreen.java

示例7: initHUD

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
/**
 * Function used to initialize all the elements of the HUD and add the respective Listeners.
 */
private void initHUD() {
    Table hudTable = new Table();
    hudTable.setFillParent(true);

    Button pauseButton = new Button(new TextureRegionDrawable(
            new TextureRegion(game.getAssetManager().get("pause.png", Texture.class))));

    scoreText = new Label("0:00", skin);
    scoreText.setFontScale(FONT_SCALE, FONT_SCALE);

    pauseButton.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            model.togglePause();
        }
    });

    hudTable.top();
    hudTable.add(scoreText).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).expandX()
            .left().fill().padLeft(HORIZONTAL_PAD).padTop(VERTICAL_PAD);
    hudTable.add(pauseButton).size(HUD_ELEMENTS_SIZE, HUD_ELEMENTS_SIZE).fill()
            .padRight(HORIZONTAL_PAD).padTop(VERTICAL_PAD);

    this.addActor(hudTable);
}
 
开发者ID:AndreFCruz,项目名称:feup-lpoo-armadillo,代码行数:29,代码来源:HudMenu.java

示例8: createAchievementButton

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的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

示例9: createSignInBtn

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的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

示例10: createLevelButtons

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的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

示例11: MessageWindow

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
public MessageWindow(String message, BitmapFont font, float width, float height) {
    setTouchable(Touchable.enabled);
    setBounds(width / 2 - width / 4, height / 2 - height / 10, width / 2, height / 5);
    texture = new Texture("theme/basic/ui/Window.png");
    this.message = message;
    table = new Table();
    table.setSize(getWidth(), getHeight());
    table.align(Align.center | Align.top);
    table.setPosition(getX(), getY());
    Label label = new Label(message, new Label.LabelStyle(font, Color.BLACK));
    label.setWrap(true);
    label.setFontScale(0.7f);
    Label label2 = new Label("Tap to continue", new Label.LabelStyle(font, Color.BLACK));
    label2.setFontScale(0.6f);
    table.add(label).width(getWidth());
    table.row();
    table.add(label2).width(getWidth()).expandY();
    table.pad(0, 30, 0, 30);
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:20,代码来源:MessageWindow.java

示例12: ScrollInventoryActor

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
public ScrollInventoryActor(Inventory inventory, int slots) {
	defaults().space(4f);

	add(new Label(inventory.getDisplayName(), new LabelStyle(Fonts.hud, Color.WHITE)));
	row();

	inner = new Table();
	inner.defaults().space(4f);
	for (int i = 0; i < inventory.itemStacks.length; i++) {
		SlotActor slotActor = new SlotActor(inventory, i);
		inner.add(slotActor);

		if ((i + 1) % inventory.width == 0) {
			inner.row();
		}
	}
	inner.pack();

	scrollPane = new ScrollPane(inner);
	scrollPane.setScrollingDisabled(true, false);
	add(scrollPane).height(slots * CALIBRATION_PER_ROW).fill();
	row();
	pack();
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:25,代码来源:ScrollInventoryActor.java

示例13: addchatlocation

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
public void addchatlocation(){
    grchatlocation = new VerticalGroup();
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd/HH:mm:ss");
    try {
        grchatlocation.addActor(addComment(sdf.parse("2016/5/17/13:34:23"),"adrian", Color.RED,"Welcome Chat!"));
        grchatlocation.addActor(addComment(sdf.parse("2016/5/17/13:34:23"),"adrian", Color.GREEN,"Location!"));
        grchatlocation.addActor(labelTest);
    } catch (ParseException e) {
        e.printStackTrace();
        Gdx.app.log("eroare","intra");
    }
    scrollchatpublic = new ScrollPane(grchatlocation);
    scrollchatpublic.layout();
    scrollchatpublic.setScrollingDisabled(true, false);
    scrollchatpublic.setFillParent(true);
    scrollchatpublic.setLayoutEnabled(true);
    tablechatpublic = new Table();
    tablechatpublic.setFillParent(false);
    tablechatpublic.add(scrollchatpublic).fill().expand();
    tablechatpublic.setBounds(WIDTH *0.05f,background1.getY(), WIDTH*0.9f,background1.getHeight() * 1.05f);
    groupbotttom.addActor(tablechatpublic);
    scrollchatpublic.setScrollPercentY(100);
    scrollchatpublic.act(Gdx.graphics.getDeltaTime());
    scrollchatpublic.updateVisualScroll();
}
 
开发者ID:TudorRosca,项目名称:enklave,代码行数:26,代码来源:ScreenChat.java

示例14: AddWindowButton

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的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: ShopBuyingDialog

import com.badlogic.gdx.scenes.scene2d.ui.Table; //导入依赖的package包/类
public ShopBuyingDialog(ShopItem item, UserInterface linkedInterface, PacketsSender packetsSender, long shopId)
{
	super(DialogUtils.humanReadableFromItemIdentifier(item.getItem().getIdentifier()), linkedInterface.getDialogs(),
			item.getItem().getId());
	this.item = item;
	totalPrice = new StringValueLabel<>("Total: ", getSkin(), item.getPrice());
	Texture texture = item.getItem().getTexture();
	Image image = new Image(texture);
	Table upperContainer = new Table();
	upperContainer.add(image).width(32).height(32).padRight(43);
	upperContainer.add(numberOfItemsField).width(40).align(Align.right);
	this.getContentTable().add(upperContainer).align(Align.left);
	this.getContentTable().row();
	this.getContentTable().add(totalPrice);
	this.getContentTable().row();
	Button buyButton = ButtonCreator.createTextButton("Buy", () -> tryToBuyAction(packetsSender, shopId, linkedInterface));
	this.getContentTable().add(buyButton);
	pack();
	DialogUtils.centerPosition(this);
}
 
开发者ID:MMORPG-Prototype,项目名称:MMORPG_Prototype,代码行数:21,代码来源:ShopBuyingDialog.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Table类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。