當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。