Java 类com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup 实例源码

项目:retro-reversi    文件:DifficultyMenuView.java   
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();
}
项目:GdxDemo3D    文件:GameStage.java   
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);
}
项目:GDXJam    文件:OptionsDialog.java   
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);
}
项目:GDXJam    文件:FormationPatternTable.java   
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);
    }
}
项目:HelixEngine    文件:HEToolbox.java   
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();
  }
}
项目:GdxStudio    文件:Serializer.java   
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());
}
项目:bladecoder-adventure-engine    文件:TabPanel.java   
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();
}
项目:bladecoder-adventure-engine    文件:ScopePanel.java   
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);
}
项目:vis-editor    文件:ToolbarModule.java   
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));
}
项目:cachebox3.0    文件:EditFilterSettings.java   
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));
    }
项目:cachebox3.0    文件:CoordinateActivity.java   
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));
    }
项目:fabulae    文件:JournalPanel.java   
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;
}
项目:fabulae    文件:JournalPanel.java   
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();
    }
}
项目:Mundus    文件:RadioButtonGroup.java   
public RadioButtonGroup() {
    super();
    buttonGroup = new ButtonGroup<>();
    buttonGroup.setMaxCheckCount(1);
    buttonGroup.setMinCheckCount(1);
    pad(5);
}
项目:gdx-skineditor    文件:WidgetsBar.java   
/**
 * 
 */
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);
    }


}
项目:ingress-indonesia-dev    文件:aa.java   
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);
}
项目:bobbybird    文件:MenuState.java   
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);
}
项目:Mundus    文件:RadioButtonGroup.java   
public ButtonGroup<RadioButton> getButtonGroup() {
    return buttonGroup;
}
项目:gdx-lml    文件:ButtonTable.java   
/** @param skin will be used to construct labels out of plain text. */
public ButtonTable(final Skin skin) {
    this(skin, new ButtonGroup<Button>());
}
项目:gdx-lml    文件:ButtonTable.java   
/** @param skin skin will be used to construct labels out of plain text.
 * @param group internally managed by the table. Will contain all {@link Button} children of the table. */
public ButtonTable(final Skin skin, final ButtonGroup<Button> group) {
    super(skin);
    this.group = group;
}
项目:gdx-lml    文件:ButtonTable.java   
/** @return internally managed {@link ButtonGroup}. */
public ButtonGroup<Button> getButtonGroup() {
    return group;
}
项目:vis-editor    文件:TabbedPane.java   
public TabbedPane (TabbedPaneStyle style, Sizes sizes) {
    this.style = style;
    this.sizes = sizes;
    listeners = new Array<TabbedPaneListener>();

    sharedCloseActiveButtonStyle = VisUI.getSkin().get("close-active-tab", VisImageButtonStyle.class);

    group = new ButtonGroup<Button>();

    mainTable = new TabbedPaneTable(this);
    tabsPane = new DragPane(style.vertical ? new VerticalFlowGroup() : new HorizontalFlowGroup());
    configureDragPane(style);

    mainTable.setBackground(style.background);

    tabs = new Array<Tab>();
    tabsButtonMap = new IdentityMap<Tab, TabButtonTable>();

    Cell<DragPane> tabsPaneCell = mainTable.add(tabsPane);
    Cell<Image> separatorCell = null;

    if (style.vertical) {
        tabsPaneCell.top().growY().minSize(0, 0);
    } else {
        tabsPaneCell.left().growX().minSize(0, 0);
    }

    //note: if separatorBar height/width is not set explicitly it may sometimes disappear
    if (style.separatorBar != null) {
        if (style.vertical) {
            separatorCell = mainTable.add(new Image(style.separatorBar)).growY().width(style.separatorBar.getMinWidth());
        } else {
            mainTable.row();
            separatorCell = mainTable.add(new Image(style.separatorBar)).growX().height(style.separatorBar.getMinHeight());
        }
    } else {
        //make sure that tab will fill available space even when there is no separatorBar image set
        if (style.vertical) {
            mainTable.add().growY();
        } else {
            mainTable.add().growX();
        }
    }

    mainTable.setPaneCells(tabsPaneCell, separatorCell);
}
项目:ead    文件:FocusItemList.java   
public FocusItemList(boolean horizontal) {
    super(horizontal);
    buttonGroup = new ButtonGroup();
}