當前位置: 首頁>>代碼示例>>Java>>正文


Java ScrollPane.setWidth方法代碼示例

本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.setWidth方法的典型用法代碼示例。如果您正苦於以下問題:Java ScrollPane.setWidth方法的具體用法?Java ScrollPane.setWidth怎麽用?Java ScrollPane.setWidth使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.badlogic.gdx.scenes.scene2d.ui.ScrollPane的用法示例。


在下文中一共展示了ScrollPane.setWidth方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createAlienInventory

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
private void createAlienInventory() {
	alienTable = new Table();
	alienTable.setWidth(INVENTORY_WIDTH);
	alienTable.padTop(6);
	alienTable.padRight(2);
	alienTable.padLeft(2);
	alienTable.padBottom(6);
	alienTable.top().left();

	ScrollPane alienScrollPane = new ScrollPane(alienTable);
	alienScrollPane.setX(Gdx.graphics.getWidth() - INVENTORY_OFFSET_X - INVENTORY_WIDTH);

	alienScrollPane.setY(INVENTORY_Y);
	alienScrollPane.setWidth(INVENTORY_WIDTH);
	alienScrollPane.setHeight(INVENTORY_HEIGHT);
	alienScrollPane.setScrollingDisabled(true, false);

	stage.addActor(alienScrollPane);

	alienCount = new Label("0", skin);
	alienCount.setStyle(Styles.LABEL_VALUE_ARTIFACT);
	alienCount.setX(Gdx.graphics.getWidth() - 120);
	alienCount.setY(560);

	stage.addActor(alienCount);
}
 
開發者ID:aphex-,項目名稱:Alien-Ark,代碼行數:27,代碼來源:ArkScreen.java

示例2: onCreateView

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
@Override
protected void onCreateView(Skin skin) {
	this.skin = skin;
	scrollPane = new ScrollPane(null, skin) {

		@Override
		public void scrollY(float pixels) {
			super.scrollY(pixels);
			model.setRelativePosition(scrollPane.getScrollPercentY());
		}

	};

	refresh();
	scrollPane.setWidth(getWidth() - getPadLeft() - getPadRight());
	scrollPane.setHeight(getHeight() - getPadTop() - getPadBottom());
	RelativeLayout.marginLeft(
			RelativeLayout.marginBottom(scrollPane, getPadBottom()),
			getPadLeft());
	scrollPane.setScrollingDisabled(true, false);
	addActor(scrollPane);
}
 
開發者ID:halfreal,項目名稱:spezi-gdx,代碼行數:23,代碼來源:VerticalListWidget.java

示例3: onCreateView

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
@Override
protected void onCreateView(Skin skin) {
	this.skin = skin;
	scrollPane = new ScrollPane(null, skin) {
		@Override
		protected void scrollX(float pixelsX) {
			super.scrollX(pixelsX);
			model.setRelativePosition(scrollPane.getScrollPercentX());
		}
	};

	refresh();
	scrollPane.setWidth(getWidth() - getPadLeft() - getPadRight());
	scrollPane.setHeight(getHeight() - getPadTop() - getPadBottom());
	RelativeLayout.marginLeft(
			RelativeLayout.marginBottom(scrollPane, getPadBottom()),
			getPadLeft());

	scrollPane.setScrollingDisabled(false, true);
	addActor(scrollPane);
}
 
開發者ID:halfreal,項目名稱:spezi-gdx,代碼行數:22,代碼來源:HorizontalListWidget.java

示例4: createPropertiesList

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
private void createPropertiesList() {
	for (Attribute a : SpaceShipProperties.properties.getAttributes()) {
		Table singleProperty = new Table();
		singleProperty.align(Align.bottomLeft);
		singleProperty.padLeft(5);
		singleProperty.setBackground(new TextureRegionDrawable(Attribute.getPropertiesTexture(a.getClass())));
		Label label = new Label(a.name(), skin);
		label.setStyle(Styles.LABEL_PROPERTY);
		singleProperty.add(label).width(410).bottom();
		Label value = new Label(String.valueOf((int)a.getCurrentValue()), skin);
		value.setStyle(Styles.LABEL_VALUE_ARTIFACT);
		singleProperty.add(value).width(110);

		propertiesTable.add(singleProperty).width(520).height(39);
		propertiesTable.row().space(3);
	}

	propertiesTable.setWidth(520);
	ScrollPane pane = new ScrollPane(propertiesTable);

	pane.setX(380);
	pane.setY(102);
	pane.setWidth(520);
	pane.setHeight(202);

	stage.addActor(pane);


}
 
開發者ID:aphex-,項目名稱:Alien-Ark,代碼行數:30,代碼來源:ArkScreen.java

示例5: createArtifactsInventory

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
private void createArtifactsInventory() {
	artifactsTable = new Table();
	artifactsTable.setWidth(INVENTORY_WIDTH);

	artifactsTable.padTop(6);
	artifactsTable.padRight(2);
	artifactsTable.padLeft(2);
	artifactsTable.padBottom(6);
	artifactsTable.top().left();
	ScrollPane artifactsScrollPane = new ScrollPane(artifactsTable);

	artifactsScrollPane.setX(INVENTORY_OFFSET_X);
	artifactsScrollPane.setY(INVENTORY_Y);
	artifactsScrollPane.setWidth(INVENTORY_WIDTH);
	artifactsScrollPane.setHeight(INVENTORY_HEIGHT);
	artifactsScrollPane.setScrollingDisabled(true, false);

	stage.addActor(artifactsScrollPane);

	artifactCount = new Label("0", skin);
	artifactCount.setStyle(Styles.LABEL_VALUE_ARTIFACT);
	artifactCount.setX(275);
	artifactCount.setY(560);

	stage.addActor(artifactCount);

}
 
開發者ID:aphex-,項目名稱:Alien-Ark,代碼行數:28,代碼來源:ArkScreen.java

示例6: ListActor

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
public ListActor(Array<Interpolator> interpolators, Assets assets) {
    this.table = new Table();

    BitmapFont font = assets.am.get(Assets.FILE_FONT_VERDANA39, BitmapFont.class);
    font.getData().setScale(0.5f);
    font.getRegion().getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);

    TextureAtlas textureAtlas = assets.am.get(Assets.FILE_ATLAS_BTN, TextureAtlas.class);
    NinePatch normal = textureAtlas.createPatch("btn_default_normal_holo_light");
    NinePatch pressed = textureAtlas.createPatch("btn_default_pressed_holo_light");

    TextButton.TextButtonStyle buttonStyle = new TextButton.TextButtonStyle();
    buttonStyle.font = font;
    buttonStyle.fontColor = Color.BLACK;
    buttonStyle.up = new NinePatchDrawable(normal);
    buttonStyle.down = new NinePatchDrawable(pressed);

    float contentWidth = 0;
    for (final Interpolator interpolator : interpolators) {
        String simpleName = interpolator.getClass().getSimpleName();

        TextButton button = new TextButton(simpleName, buttonStyle);
        ClickListener listener = new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                onSelectedInterpolator(interpolator);
            }
        };
        button.addListener(listener);
        table.add(button).align(Align.left);
        table.row();
        contentWidth = Math.max(contentWidth, button.getWidth());
    }
    scrollPane = new ScrollPane(table);
    scrollPane.setWidth(contentWidth);
    this.addActor(scrollPane);
    setWidth(contentWidth);
}
 
開發者ID:ReKayo-System,項目名稱:libgdx-interpolator,代碼行數:39,代碼來源:ListActor.java

示例7: GUIList

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
public GUIList()
{
    this.name = "GenericGUIList";
    this.window = new Window(this.name,
            GameManager.getSkin(GameManager.selectedSkin), "window");
    this.window.setName(name);
    this.window.setPosition(0 / (float)Vars.getDouble("balancedScreenWidth"),
            0 / (float)Vars.getDouble("balancedScreenHeight"));
    this.window.setHeight(0 / (float)Vars.getDouble("balancedScreenHeight"));
    this.window.setWidth(0 / (float)Vars.getDouble("balancedScreenWidth"));
    window.defaults().padLeft(0);
    window.defaults().padRight(0);
    window.defaults().padTop(0);
    window.defaults().padBottom(0);
    window.defaults().minWidth(100 / (float)Vars.getDouble("balancedScreenWidth"));
    window.defaults().minHeight(30 / (float)Vars.getDouble("balancedScreenHeight"));

    table = new Table();
    table.defaults().padLeft(0);
    table.defaults().padRight(0);
    table.defaults().padTop(0);
    table.defaults().padBottom(0);
    table.setFillParent(true);
    table.setWidth(100);
    table.setHeight(30);
    table.left();
    table.bottom();

    scroll = new ScrollPane(table);
    scroll.setScrollBarPositions(false, true);
    scroll.setScrollingDisabled(true, true);
    scroll.setScrollbarsOnTop(true);
    scroll.setFadeScrollBars(false);
    scroll.setFillParent(true);
    scroll.setSmoothScrolling(false);
    scroll.setWidth(90);
    scroll.setHeight(30);

    window.add(scroll).fill();
}
 
開發者ID:MosaicOwl,項目名稱:the-erder,代碼行數:41,代碼來源:GUIList.java

示例8: create

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
public void create () {
	stage = new Stage();
	Gdx.input.setInputProcessor(stage);

	skin = new Skin(Gdx.files.internal("data/uiskin.json"));

	ScrollPane pane2 = new ScrollPane(new Image(new Texture("data/group-debug.png")), skin);
	pane2.setScrollingDisabled(false, true);
	// pane2.setCancelTouchFocus(false);
	pane2.addListener(new InputListener() {
		public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
			event.stop();
			return true;
		}
	});

	Table mytable = new Table();
	mytable.debug();
	mytable.add(new Image(new Texture("data/group-debug.png")));
	mytable.row();
	mytable.add(new Image(new Texture("data/group-debug.png")));
	mytable.row();
	mytable.add(pane2).size(100);
	mytable.row();
	mytable.add(new Image(new Texture("data/group-debug.png")));
	mytable.row();
	mytable.add(new Image(new Texture("data/group-debug.png")));

	ScrollPane pane = new ScrollPane(mytable, skin);
	pane.setScrollingDisabled(true, false);
	// pane.setCancelTouchFocus(false);
	if (false) {
		// This sizes the pane to the size of it's contents.
		pane.pack();
		// Then the height is hardcoded, leaving the pane the width of it's contents.
		pane.setHeight(Gdx.graphics.getHeight());
	} else {
		// This shows a hardcoded size.
		pane.setWidth(300);
		pane.setHeight(Gdx.graphics.getHeight());
	}

	stage.addActor(pane);
}
 
開發者ID:basherone,項目名稱:libgdxcn,代碼行數:45,代碼來源:ScrollPane2Test.java

示例9: GUIContainer

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
public GUIContainer(String n, Window w, ContainerType type,
        Vector2 vector2, Vector2 vector22, int j, int i, int k, int l)
{
    this.name = n;
    this.type = type;
    modal = w;
    this.modal.setPosition(vector2.x / (float)Vars.getDouble("balancedScreenWidth"),
            vector2.y / (float)Vars.getDouble("balancedScreenHeight"));
    this.modal.setHeight(vector22.y / (float)Vars.getDouble("balancedScreenHeight"));
    this.modal.setWidth(vector22.x / (float)Vars.getDouble("balancedScreenWidth"));
    modal.defaults().padLeft(i);
    modal.defaults().padRight(j);
    modal.defaults().padTop(k);
    modal.defaults().padBottom(l);
    modal.defaults().minWidth(100);
    modal.defaults().minHeight(30);
    modal.setMovable(true);

    table = new Table();
    table.defaults().padLeft(i);
    table.defaults().padRight(j);
    table.defaults().padTop(k);
    table.defaults().padBottom(l);
    table.setFillParent(true);
    table.setWidth(vector22.x - i - j);
    table.setHeight(vector22.y - k - l);
    table.left();
    table.bottom();

    scroll = new ScrollPane(table);
    scroll.setScrollBarPositions(false, true);
    scroll.setScrollingDisabled(true, false);
    scroll.setScrollbarsOnTop(true);
    scroll.setFadeScrollBars(false);
    scroll.setFillParent(true);
    scroll.setSmoothScrolling(false);
    scroll.setWidth(vector22.x - 10);
    scroll.setHeight(vector22.y - 10);

    modal.add(table).fill();
}
 
開發者ID:MosaicOwl,項目名稱:the-erder,代碼行數:42,代碼來源:GUIContainer.java

示例10: GUIServerList

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
public GUIServerList()
{
    this.window = new Window("servers_list",
            GameManager.getSkin(GameManager.selectedSkin), "window");
    this.window.setHeight(500 / (float)Vars.getDouble("balancedScreenHeight"));
    this.window.setWidth(500 / (float)Vars.getDouble("balancedScreenWidth"));
    window.defaults().padLeft(10);
    window.defaults().padRight(10);
    window.defaults().padTop(10);
    window.defaults().padBottom(10);
    window.defaults().prefWidth(500 / (float)Vars.getDouble("balancedScreenWidth"));
    window.defaults()
            .prefHeight(500 / (float)Vars.getDouble("balancedScreenHeight"));

    table = new Table();
    table.defaults().padLeft(10);
    table.defaults().padRight(10);
    table.defaults().padTop(10);
    table.defaults().padBottom(10);
    table.setFillParent(true);
    table.setWidth(480);
    table.setHeight(480);
    table.left();
    table.bottom();

    scroll = new ScrollPane(table);
    scroll.setScrollBarPositions(false, true);
    scroll.setScrollingDisabled(true, true);
    scroll.setScrollbarsOnTop(true);
    scroll.setFadeScrollBars(false);
    scroll.setFillParent(true);
    scroll.setSmoothScrolling(false);
    scroll.setWidth(480);
    scroll.setHeight(480);

    window.add(scroll).fill();
    window.setTitle("Pick a server");
    mainTable = new Table();
    mainTable.setFillParent(true);
    mainTable.add(window);
}
 
開發者ID:MosaicOwl,項目名稱:the-erder,代碼行數:42,代碼來源:GUIServerList.java

示例11: GUIChatWindow

import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane; //導入方法依賴的package包/類
public GUIChatWindow(String n, Window w, Vector2 vector2, Vector2 vector22,
        int i, int j, int k, int l)
{
    this.name = n;
    this.window = w;
    this.window.setName(n);
    this.window.setPosition(vector2.x / (float)Vars.getDouble("balancedScreenWidth"),
            vector2.y / (float)Vars.getDouble("balancedScreenHeight"));
    this.window.setHeight(vector22.y / (float)Vars.getDouble("balancedScreenHeight"));
    this.window.setWidth(vector22.x / (float)Vars.getDouble("balancedScreenWidth"));
    window.defaults().padLeft(i);
    window.defaults().padRight(j);
    window.defaults().padTop(k);
    window.defaults().padBottom(l);
    window.defaults().prefWidth(
            vector22.x / (float)Vars.getDouble("balancedScreenWidth"));
    window.defaults().prefHeight(
            vector22.y / (float)Vars.getDouble("balancedScreenHeight"));

    table = new Table();
    table.defaults().padLeft(i);
    table.defaults().padRight(j);
    table.defaults().padTop(k);
    table.defaults().padBottom(l);
    table.setFillParent(true);
    table.setWidth(vector22.x - i - j);
    table.setHeight(vector22.y - k - l);
    table.left();
    table.bottom();

    scroll = new ScrollPane(table);
    scroll.setScrollBarPositions(false, true);
    scroll.setScrollingDisabled(true, true);
    scroll.setScrollbarsOnTop(true);
    scroll.setFadeScrollBars(false);
    scroll.setFillParent(true);
    scroll.setSmoothScrolling(false);
    scroll.setWidth(vector22.x - 10);
    scroll.setHeight(vector22.y - 20);

    window.add(scroll).fill();
}
 
開發者ID:MosaicOwl,項目名稱:the-erder,代碼行數:43,代碼來源:GUIChatWindow.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.setWidth方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。