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


Java ButtonGroup类代码示例

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


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

示例1: addPieceChoice

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
private void addPieceChoice(){
    buttonTable = new Table();
    buttonTable.bottom();
    buttonTable.setFillParent(true);

    pieceChoiceGroup = new ButtonGroup<CheckBox>();
    whiteCheckBox = new CheckBox(" White", game.getSkin());
    blackCheckBox = new CheckBox(" Black", game.getSkin());
    pieceChoiceGroup.add(blackCheckBox);
    pieceChoiceGroup.add(whiteCheckBox);
    pieceChoiceGroup.setMaxCheckCount(1);
    pieceChoiceGroup.setMinCheckCount(1);
    pieceChoiceGroup.setUncheckLast(true);
    pieceChoiceGroup.setChecked("Black");

    buttonTable.add(whiteCheckBox).center().padBottom(15).row();
    buttonTable.add(blackCheckBox).center().padBottom(40).row();
}
 
开发者ID:antonioalmeida,项目名称:retro-reversi,代码行数:19,代码来源:DifficultyMenuView.java

示例2: CharacterController

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public CharacterController(TextureAtlas buttonAtlas) {
	whistleButton = new CharacterButton(HumanState.WHISTLE, buttonAtlas, "whistle-up", "whistle-down", "whistle-down");
	throwButton = new CharacterButton(HumanState.THROW, buttonAtlas, "throw-up", "throw-down", "throw-down");

	radioGroup = new ButtonGroup<CharacterButton>(
			new CharacterButton(HumanState.MOVE_RUN, buttonAtlas, "run-up", "run-down", "run-down"),
			new CharacterButton(HumanState.MOVE_WALK, buttonAtlas, "walk-up", "walk-down", "walk-down"),
			new CharacterButton(HumanState.MOVE_CROUCH, buttonAtlas, "crouch-up", "crouch-down", "crouch-down"),
			//new CharacterButton(CharacterState.MOVE_CRAWL, buttonAtlas, "crawl-up", "crawl-down", "crawl-down"),
			new CharacterButton(HumanState.DEAD, buttonAtlas, "kill-up", "kill-down", "kill-down")
	);

	// Add whistle button and save the reference to the 1st cell
	this.dogCell = add(whistleButton);

	// Add radio buttons
	for (CharacterButton btn : radioGroup.getButtons()) {
		add(btn);
	}

	// Register this controller's interests
	MessageManager.getInstance().addListeners(this,
			Constants.MSG_GUI_CLEAR_DOG_BUTTON,
			Constants.MSG_GUI_SET_DOG_BUTTON_TO_WHISTLE,
			Constants.MSG_GUI_SET_DOG_BUTTON_TO_THROW);
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:27,代码来源:GameStage.java

示例3: OptionsDialog

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public OptionsDialog (Skin skin) {
	super("Options", skin);
	setPosition((Gdx.graphics.getWidth() * 0.5f) - (getWidth() * 0.5f), (Gdx.graphics.getHeight() * 0.5f)
		- (getHeight() * 0.5f));
	setMovable(false);
	setModal(true);

	
	graphicsOptions = new GraphicsOptions(skin);
	audioOptions = new AudioOptions(skin);
	
	tabButtonGroup = new ButtonGroup<TextButton>();
	tabButtonGroup.setMaxCheckCount(1);
	tabButtonGroup.setMinCheckCount(1);
	tabButtonGroup.setChecked(graphicsOptions.getName());
	
	tabTable = new Table();
	addTab(graphicsOptions, skin);
	addTab(audioOptions, skin);
	setContent(graphicsOptions);
	
	TextButton closeButton = new TextButton("Close", skin);
	button(closeButton);
}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:25,代码来源:OptionsDialog.java

示例4: FormationPatternTable

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public FormationPatternTable (final Entity squad, Skin skin) {
	this.skin = skin;
	buttonGroup = new ButtonGroup<ImageButton>();
	buttonGroup.setMaxCheckCount(1);
	buttonGroup.setMinCheckCount(1);

	for(int i = 0; i < FormationPatternType.values().length; i++){
		final ImageButton button = createFormationButton(FormationPatternType.values()[i], skin);
		button.addListener(new ChangeListener() {
		
			@Override
			public void changed (ChangeEvent event, Actor actor) {
				if(button.isChecked()){
					Components.SQUAD.get(squad).setFormationPattern((FormationPatternType) button.getUserObject());
				}
				
			}
		});
		
		add(button);
		buttonGroup.add(button);
	}
}
 
开发者ID:libgdx-jam,项目名称:GDXJam,代码行数:24,代码来源:FormationPatternTable.java

示例5: 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

示例6: setup

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public static void setup(){
	registerSerializer(Actor.class, new ActorSerializer());
	registerSerializer(Scene.class, new SceneSerializer());
	registerSerializer(ImageJson.class, new ImageJson());
	registerSerializer(Label.class, new LabelSerializer());
	registerSerializer(Button.class, new ButtonSerializer());
	registerSerializer(TextButton.class, new TextButtonSerializer());
	registerSerializer(Table.class, new TableSerializer());
	registerSerializer(CheckBox.class, new CheckBoxSerializer());
	registerSerializer(SelectBox.class, new SelectBoxSerializer());
	registerSerializer(List.class, new ListSerializer());
	registerSerializer(Slider.class, new SliderSerializer());
	registerSerializer(TextField.class, new TextFieldSerializer());
	registerSerializer(Touchpad.class, new TouchpadSerializer());
	registerSerializer(Sprite.class, new SpriteSerializer());
	
	registerSerializer(Dialog.class, new DialogSerializer());
	registerSerializer(SplitPane.class, new SplitPaneSerializer());
	registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
	registerSerializer(Stack.class, new StackSerializer());
	registerSerializer(Tree.class, new TreeSerializer());
	registerSerializer(Table.class, new TableSerializer());
	registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
	registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
	registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:27,代码来源:Serializer.java

示例7: TabPanel

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public TabPanel(Skin skin) {
	super(skin);
	this.skin = skin;
	buttonGroup = new ButtonGroup<Button>();
	header = new HorizontalGroup();
	body = new Container<Actor>();
	tabs = new ArrayList<Tab>();
	
	buttonGroup.setMaxCheckCount(1);
	buttonGroup.setMinCheckCount(1);
	buttonGroup.setUncheckLast(true);
	
	header.wrap(true);
	header.rowAlign(Align.left);
	
	add(header).expandX().fillX().left();
	row();
	add(body).expand().fill();

	body.fill();
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:22,代码来源:TabPanel.java

示例8: ScopePanel

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public ScopePanel(Skin skin) {
	super(skin);
	this.skin = skin;
	buttonGroup = new ButtonGroup<TextButton>();
	hPanel = new HorizontalGroup();
	hPanel.wrap(true);
	hPanel.rowAlign(Align.left);
	
	buttonGroup.setMaxCheckCount(1);
	buttonGroup.setMinCheckCount(1);
	buttonGroup.setUncheckLast(true);
	
	hPanel.addActor(new Label("Scope: ", skin));
	
	addButton(WORLD_SCOPE);
	addButton(SCENE_SCOPE);
	addButton(ACTOR_SCOPE);
	
	add(hPanel).expandX().fillX().center();
	
	buttonGroup.getButtons().get(2).setChecked(true);
}
 
开发者ID:bladecoder,项目名称:bladecoder-adventure-engine,代码行数:23,代码来源:ScopePanel.java

示例9: ToolbarModule

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public ToolbarModule () {
	toolsGroup = new ButtonGroup<>();

	table = new VisTable(false);
	table.defaults().pad(4, 0, 4, 3);
	table.setBackground(VisUI.getSkin().getDrawable("button"));

	table.add(new ToolbarButtonBuilder().icon(Icons.SAVE)
			.text("Save (" + OsUtils.getShortcutFor(Keys.CONTROL_LEFT, Keys.S) + ")").eventToolbar(ToolbarEventType.FILE_SAVE)
			.policy(ControllerPolicy.SAVABLE).build());

	table.addSeparator(true);
	table.add(new ToolbarButtonBuilder().icon(Icons.TOOL_MOVE).text("Select and move entities (F1)").eventTool(SelectionTool.TOOL_ID).build());
	table.add(new ToolbarButtonBuilder().icon(Icons.TOOL_ROTATE).text("Rotate entities (F2)").eventTool(RotateTool.TOOL_ID).build());
	table.add(new ToolbarButtonBuilder().icon(Icons.TOOL_SCALE).text("Scale entities (F3)").eventTool(ScaleTool.TOOL_ID).build());
	table.add(new ToolbarButtonBuilder().icon(Icons.POLYGON).text("Edit polygons (F4)").eventTool(PolygonTool.TOOL_ID).build());

	table.addSeparator(true);
	table.add(new ToolbarButtonBuilder().icon(Icons.SETTINGS_VIEW).text("Enable grid snapping (%)").eventToolbar(ToolbarEventType.GRID_SNAP_SETTING_CHANGED).toggle().build());

	table.add().expand().fill();

	savableScope.forEach(button -> button.setDisabled(true));
	sceneScope.forEach(button -> button.setDisabled(true));
}
 
开发者ID:kotcrab,项目名称:vis-editor,代码行数:26,代码来源:ToolbarModule.java

示例10: createToggleBtn

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
private void createToggleBtn() {

        btnGroup = new ButtonGroup<>();

        VisTextButton.VisTextButtonStyle buttonStyle = VisUI.getSkin().get("toggle", VisTextButton.VisTextButtonStyle.class);

        buttonStyle.font = style.toggleButtonFont;
        buttonStyle.fontColor = style.toggleButtonFontColor;

        tglBtnPreset = new CharSequenceButton(Translation.get("preset"), buttonStyle);
        tglBtnSet = new CharSequenceButton(Translation.get("setting"), buttonStyle);
        tglBtnCategory = new CharSequenceButton(Translation.get("category"), buttonStyle);
        tglBtnText = new CharSequenceButton(Translation.get("text"), buttonStyle);

        tglBtnPreset.addListener(tglListener);
        tglBtnSet.addListener(tglListener);
        tglBtnCategory.addListener(tglListener);
        tglBtnText.addListener(tglListener);

        btnGroup.add(tglBtnPreset);
        btnGroup.add(tglBtnSet);
        btnGroup.add(tglBtnCategory);
        btnGroup.add(tglBtnText);


        Table tglTbl = new Table();
        tglTbl.defaults().space(CB.scaledSizes.MARGIN / 4);

        tglTbl.add(tglBtnPreset).expandX().fillX();
        tglTbl.add(tglBtnSet).expandX().fillX();

        //ISSUE (#167 implement Filter for Category)
//        tglTbl.add(tglBtnCategory).expandX().fillX();

        //ISSUE (#168 implement Filter for Text(CacheName/GcCode/OwnerName))
//        tglTbl.add(tglBtnText).expandX().fillX();

        this.add(tglTbl).width(new Value.Fixed(Gdx.graphics.getWidth() - CB.scaledSizes.MARGINx2));
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:40,代码来源:EditFilterSettings.java

示例11: createToggleBtn

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
private void createToggleBtn() {

        btnGroup = new ButtonGroup<VisTextButton>();

        tglBtnDec = new VisTextButton("Dec", "toggle");
        tglBtnMin = new VisTextButton("Min", "toggle");
        tglBtnSec = new VisTextButton("Sec", "toggle");
        tglBtnUtm = new VisTextButton("UTM", "toggle");

        tglBtnDec.addListener(tglListener);
        tglBtnMin.addListener(tglListener);
        tglBtnSec.addListener(tglListener);
        tglBtnUtm.addListener(tglListener);

        btnGroup.add(tglBtnDec);
        btnGroup.add(tglBtnMin);
        btnGroup.add(tglBtnSec);
        btnGroup.add(tglBtnUtm);


        Table tglTbl = new Table();
        tglTbl.defaults().space(CB.scaledSizes.MARGIN / 4);

        float btnWidth = (Gdx.graphics.getWidth() - CB.scaledSizes.MARGIN * 3) / 4;


        tglTbl.add(tglBtnDec).width(new Value.Fixed(btnWidth));
        tglTbl.add(tglBtnMin).width(new Value.Fixed(btnWidth));
        tglTbl.add(tglBtnSec).width(new Value.Fixed(btnWidth));
        tglTbl.add(tglBtnUtm).width(new Value.Fixed(btnWidth));

        this.add(tglTbl).top().width(new Value.Fixed(Gdx.graphics.getWidth() - CB.scaledSizes.MARGINx2));
    }
 
开发者ID:Longri,项目名称:cachebox3.0,代码行数:34,代码来源:CoordinateActivity.java

示例12: buildTabs

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
private Actor buildTabs() {
	Table tabs = new Table();
	activeQuestsButton = new TextButtonWithSound(Strings.getString(UIManager.STRING_TABLE, "activeQuestsButton"), style.tabHeadingStyle);
	activeQuestsButton.padLeft(style.textPaddingLeft).padRight(style.textPaddingRight);
	completedQuestsButton = new TextButtonWithSound(Strings.getString(UIManager.STRING_TABLE, "completedQuestsButton"), style.tabHeadingStyle);
	completedQuestsButton.padLeft(style.textPaddingLeft).padRight(style.textPaddingRight);
	ButtonGroup<TextButtonWithSound> group = new ButtonGroup<TextButtonWithSound>(activeQuestsButton, completedQuestsButton);
	group.setUncheckLast(true);
	group.setMaxCheckCount(1);
	tabs.add(activeQuestsButton);
	tabs.add().prefWidth(style.tabSpacing).fill();
	tabs.add(completedQuestsButton);
	tabs.add().expand();
	return tabs;
}
 
开发者ID:mganzarcik,项目名称:fabulae,代码行数:16,代码来源:JournalPanel.java

示例13: 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

示例14: RadioButtonGroup

import com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup; //导入依赖的package包/类
public RadioButtonGroup() {
    super();
    buttonGroup = new ButtonGroup<>();
    buttonGroup.setMaxCheckCount(1);
    buttonGroup.setMinCheckCount(1);
    pad(5);
}
 
开发者ID:mbrlabs,项目名称:Mundus,代码行数:8,代码来源:RadioButtonGroup.java

示例15: 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


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