List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Button getStyle
public ButtonStyle getStyle()
From source file:com.bladecoder.engine.ui.LoadSaveScreen.java
License:Apache License
/** * Creates a button to represent one slot * * @param slot/* ww w.ja v a 2 s . c o m*/ * @return The button to use for one slot */ private Button getSlotButton(String slot) { final Skin skin = ui.getSkin(); final Button button = new Button(new ButtonStyle()); final ButtonStyle style = button.getStyle(); style.up = style.down = skin.getDrawable("black"); String textLabel = I18N.getString("ui.newSlot"); button.setSize(slotWidth, slotHeight); if (slotExists(slot)) { button.add(getScreenshot(slot)).maxSize(slotWidth * .95f, slotHeight * .95f); try { long l = Long.parseLong(slot); Date d = new Date(l); textLabel = (new SimpleDateFormat()).format(d); } catch (Exception e) { textLabel = slot; } button.addListener(loadClickListener); } else { Image fg = new Image(skin.getDrawable("plus")); button.add(fg).maxSize(slotHeight / 2, slotHeight / 2); button.addListener(saveClickListener); } button.row(); Label label = new Label(textLabel, skin); label.setAlignment(Align.center); button.add(label).fillX(); button.setName(slot); return button; }
From source file:es.eucm.ead.engine.processors.controls.ButtonProcessor.java
License:Open Source License
@Override public Component getComponent(Button component) { Skin skin = gameAssets.getSkin();// w ww .j a v a 2s . co m ControlComponent button = gameLoop.createComponent(ControlComponent.class); button.setControl(new com.badlogic.gdx.scenes.scene2d.ui.Button( new ButtonStyle(skin.get(component.getStyle(), ButtonStyle.class)))); return button; }