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


Java ButtonGroup.add方法代码示例

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


在下文中一共展示了ButtonGroup.add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: HEToolbox

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入方法依赖的package包/类
public HEToolbox() {
  super(true);

  ButtonGroup<Button> toolButtons = new ButtonGroup<>();

  for (final ToolType type : ToolType.values()) {
    Button button = new VisTextButton(type.toString(), "toggle");
    button.addListener(new ChangeListener() {
          @Override
          public void changed(ChangeEvent event, Actor actor) {
            if (((Button) actor).isChecked()) {
              HelixEditor.getInstance().getToolbarState().setActiveTool(type);
            }
          }
        });

    toolButtons.add(button);

    add(button).padBottom(-8);

    row();
  }
}
 
开发者ID:fauu,项目名称:HelixEngine,代码行数:24,代码来源:HEToolbox.java

示例2: reloadQuests

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入方法依赖的package包/类
private void reloadQuests(Array<Quest> questsToLoad) {
	questList.clear();
	questName.setText("");
	questDescription.setText("");
	ButtonGroup<TextButtonWithSound> group = new ButtonGroup<TextButtonWithSound>();
	group.setUncheckLast(true);
	group.setMaxCheckCount(1);
	for (final Quest quest : questsToLoad) {
		final TextButtonWithSound questButton = new TextButtonWithSound(quest.getName(), style.questNameStyle);
		questButton.padLeft(style.textPaddingLeft).padRight(style.textPaddingRight);
		questButton.addListener(new ChangeListener() {
			@Override
			public void changed(ChangeEvent event, Actor actor) {
				if (questButton.isChecked()) {
					questName.setText(quest.getName());
					questDescription.setText(quest.getStory());
					descriptionScollPane.layout();
					descriptionScollPane.setScrollY(descriptionScollPane.getMaxY());
				}
			}});
		group.add(questButton);
		questButton.getLabel().setWrap(true);
		questButton.getLabel().setAlignment(Align.left);
		questList.add(questButton).fill().prefWidth(style.questListWidth-style.textPaddingLeft-style.textPaddingRight).left();
		questList.row();
	}
	if (questsToLoad.size == 0) {
		TextButtonWithSound button = new TextButtonWithSound(Strings.getString(UIManager.STRING_TABLE, "noQuests"), style.questNameStyle);
		button.padLeft(style.textPaddingLeft).padRight(style.textPaddingRight);
		button.getLabel().setWrap(true);
		button.getLabel().setAlignment(Align.left);
		button.setDisabled(true);
		group.setMaxCheckCount(0);
		group.setMinCheckCount(0);
		group.add(button);
		questList.add(button).prefWidth(style.questListWidth-style.textPaddingLeft-style.textPaddingRight).fill().left();
		questList.row();
	}
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:40,代码来源:JournalPanel.java

示例3: initializeButtons

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入方法依赖的package包/类
/**
 * 
 */
public void initializeButtons() {
	
	group = new ButtonGroup();

	Tooltips.TooltipStyle styleTooltip = new Tooltips.TooltipStyle(game.skin.getFont("default-font"), game.skin.getDrawable("default-round"), game.skin.getColor("white"));		

	String[] widgets = SkinEditorGame.widgets;
	for (String widget : widgets) {

		ImageButtonStyle style = new ImageButtonStyle();
		style.checked = game.skin.getDrawable("default-round-down");
		style.down = game.skin.getDrawable("default-round-down");
		style.up = game.skin.getDrawable("default-round");
		style.imageUp = game.skin.getDrawable("widgets/" + widget);
		ImageButton button = new ImageButton(style);
		button.setUserObject(widget);

		Tooltips tooltip = new Tooltips(styleTooltip, getStage());
		tooltip.registerTooltip(button, (String) button.getUserObject()); 
		
		button.addListener(new ClickListener() {

			@Override
			public void clicked(InputEvent event, float x, float y) {
				game.screenMain.panePreview.refresh();
				game.screenMain.paneOptions.refresh();

			}

		});

		group.add(button);
		add(button).pad(5);
	}
	
	
}
 
开发者ID:cobolfoo,项目名称:gdx-skineditor,代码行数:41,代码来源:WidgetsBar.java

示例4: a

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入方法依赖的package包/类
public final void a()
{
  this.e.reset();
  ButtonGroup localButtonGroup = new ButtonGroup();
  AudibleTwoTextButton.TwoTextButtonStyle localTwoTextButtonStyle1 = (AudibleTwoTextButton.TwoTextButtonStyle)this.c.get("tab-bar-unchecked", AudibleTwoTextButton.TwoTextButtonStyle.class);
  AudibleTwoTextButton.TwoTextButtonStyle localTwoTextButtonStyle2 = (AudibleTwoTextButton.TwoTextButtonStyle)this.c.get("tab-bar-checked", AudibleTwoTextButton.TwoTextButtonStyle.class);
  this.e.add();
  float f1 = 0.02F * this.d.getWidth();
  float f2 = 0.035F * this.d.getWidth();
  float f3 = 0.08F * this.d.getWidth();
  Object localObject = null;
  ag[] arrayOfag = a.d();
  int i = arrayOfag.length;
  int j = 0;
  if (j < i)
  {
    ag localag = arrayOfag[j];
    AudibleTwoTextButton localAudibleTwoTextButton;
    if ((ao.l()) || (localag != ag.b))
    {
      if (this.b != localag)
        break label218;
      localAudibleTwoTextButton = new AudibleTwoTextButton(localag.toString(), localag.a(), localTwoTextButtonStyle2);
      localAudibleTwoTextButton.pad(f1, f3, f2, f3);
      localObject = localAudibleTwoTextButton;
    }
    while (true)
    {
      this.e.add(localAudibleTwoTextButton).p().j();
      localAudibleTwoTextButton.addListener(new ad(this, localag));
      j++;
      break;
      label218: localAudibleTwoTextButton = new AudibleTwoTextButton(localag.toString(), localag.a(), localTwoTextButtonStyle1);
      localAudibleTwoTextButton.pad(f1, f3, f1, f3);
      localButtonGroup.add(localAudibleTwoTextButton);
    }
  }
  this.d.layout();
  this.d.setScrollX(-getWidth() / 2.0F + localObject.getX() + localObject.getWidth() / 2.0F);
}
 
开发者ID:isnuryusuf,项目名称:ingress-indonesia-dev,代码行数:41,代码来源:aa.java

示例5: showCharacterDialog

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入方法依赖的package包/类
private void showCharacterDialog() {
    Dialog dialog = new Dialog("", skin);
    
    Label label = new Label("Choose a character...", skin);
    dialog.getContentTable().add(label);
    
    dialog.getContentTable().row();
    Table table = new Table();
    ScrollPane scrollPane = new ScrollPane(table, skin);
    scrollPane.setFadeScrollBars(false);
    dialog.getContentTable().add(scrollPane).grow();
    
    final ButtonGroup<ImageTextButton> buttons = new ButtonGroup<ImageTextButton>();
    for (String name : getCore().getImagePacks().get(DATA_PATH + "/characters")) {
        Drawable drawable = new TextureRegionDrawable(getCore().getAtlas().findRegion(name));
        Image image = new Image(drawable);
        ImageTextButton imageTextButton = new ImageTextButton(name, skin, "list");
        imageTextButton.getImageCell().setActor(image);
        imageTextButton.getLabelCell().left().expandX();
        table.add(imageTextButton).growX();
        buttons.add(imageTextButton);
        
        table.row();
    }
    
    dialog.getContentTable().row();
    TextButton textButton = new TextButton("OK", skin);
    dialog.getContentTable().add(textButton);
    
    textButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeListener.ChangeEvent event, Actor actor) {
            getCore().getAssetManager().get(Core.DATA_PATH + "/sfx/coin.wav", Sound.class).play();
            ((GameState)getCore().getStateManager().getState("game")).setSelectedCharacter(buttons.getChecked().getText().toString());
            
            Gdx.input.setInputProcessor(null);
            Action changeStateAction = new Action() {
                @Override
                public boolean act(float delta) {
                    getCore().getStateManager().loadState("game");
                    return true;
                }
            };
            root.addAction(new SequenceAction(new DelayAction(.5f), changeStateAction));
        }
    });
    
    dialog.show(stage);
    dialog.setSize(400.0f, 400.0f);
    dialog.setPosition(stage.getWidth() / 2.0f, stage.getHeight() / 2.0f, Align.center);
    stage.setScrollFocus(scrollPane);
}
 
开发者ID:raeleus,项目名称:bobbybird,代码行数:53,代码来源:MenuState.java


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