com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup Java Examples
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.ui.ButtonGroup.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GameStage.java From GdxDemo3D with Apache License 2.0 | 6 votes |
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); }
Example #2
Source File: TabPanel.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
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(); }
Example #3
Source File: ScopePanel.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
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); }
Example #4
Source File: RadioButtonGroup.java From Mundus with Apache License 2.0 | 5 votes |
public RadioButtonGroup() { super(); buttonGroup = new ButtonGroup<>(); buttonGroup.setMaxCheckCount(1); buttonGroup.setMinCheckCount(1); pad(5); }
Example #5
Source File: WidgetsBar.java From gdx-skineditor with Apache License 2.0 | 5 votes |
/** * */ 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); } }
Example #6
Source File: RadioButtonGroup.java From Mundus with Apache License 2.0 | 4 votes |
public ButtonGroup<RadioButton> getButtonGroup() { return buttonGroup; }
Example #7
Source File: TabbedPane.java From vis-ui with Apache License 2.0 | 4 votes |
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); }