List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ImageButton getImage
public Image getImage()
From source file:com.agateau.ui.UiBuilder.java
License:Apache License
protected ImageButton createImageButton(XmlReader.Element element) { String styleName = element.getAttribute("style", "default"); ImageButton.ImageButtonStyle style = new ImageButton.ImageButtonStyle( mSkin.get(styleName, ImageButton.ImageButtonStyle.class)); String imageName = element.getAttribute("imageName", ""); if (!imageName.isEmpty()) { style.imageUp = mSkin.getDrawable(imageName); }//from w ww.ja v a 2 s . com ImageButton button = new ImageButton(style); String imageColor = element.getAttribute("imageColor", ""); if (!imageColor.isEmpty()) { Color color = Color.valueOf(imageColor); button.getImage().setColor(color); } return button; }
From source file:com.strategames.ui.dialogs.GameObjectPickerDialog.java
License:Open Source License
/** * Use this to create and add the actual dialog to the stage. *///from w ww. j a va2 s . com public Dialog create() { setPosition(0, 0); defaults().spaceBottom(2); row(); Array<GameObject> gameObjects = this.game.getAvailableGameObjects(); for (GameObject object : gameObjects) { final GameObject gameObject = object; Drawable drawable = gameObject.getDrawable(); ImageButton iButton = new ImageButton(drawable); Image image = iButton.getImage(); image.setScale(IMAGEWIDTH / drawable.getMinWidth()); iButton.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { selectedGameObject = gameObject; listener.onClick(GameObjectPickerDialog.this, BUTTON_GAMEOBJECTSELECTED); GameObjectPickerDialog.this.remove(); } }); add(iButton); row(); } for (TextButton button : this.textButtons) { add(button); row(); } pack(); return super.create(); }
From source file:org.anism.lotw.LOTW.java
License:Open Source License
public ImageButton addIconButton(Stage src, Texture texture, ClickListener cl, float cx, float cy, float w, float h) { ImageButton.ImageButtonStyle imgBtnStyle = new ImageButton.ImageButtonStyle(buttonStyle); TextureRegion rgn = new TextureRegion(texture); TextureRegionDrawable dbl = new TextureRegionDrawable(rgn); imgBtnStyle.imageUp = dbl;/*from w w w . j av a2 s .c o m*/ imgBtnStyle.imageDown = dbl; imgBtnStyle.imageOver = dbl; imgBtnStyle.imageChecked = dbl; imgBtnStyle.imageCheckedOver = dbl; imgBtnStyle.imageDisabled = dbl; ImageButton button = new ImageButton(imgBtnStyle); button.setWidth(w * dpi); button.setHeight(h * dpi); button.setPosition(G.width / 2 + cx * dpi - button.getWidth() / 2, G.height / 2 + cy * dpi - button.getHeight() / 2); button.addListener(cl); Color c = new Color(G.getAntiColor()); c.a = 1; button.getImage().setColor(c); if (src != null) { src.addActor(button); } return button; }