Example usage for com.badlogic.gdx.scenes.scene2d.ui ImageButton setStyle

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ImageButton setStyle

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui ImageButton setStyle.

Prototype

public void setStyle(ButtonStyle style) 

Source Link

Usage

From source file:com.bladecoder.engineeditor.ui.components.EditToolbar.java

License:Apache License

public void addToolBarButton(ImageButton button, String icon, String text, String tooltip) {

    TextureRegion image = Ctx.assetManager.getIcon(icon);
    TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");

    ImageButtonStyle style = new ImageButtonStyle(skin.get("plain", ButtonStyle.class));
    style.imageUp = new TextureRegionDrawable(image);

    if (imageDisabled != null)
        style.imageDisabled = new TextureRegionDrawable(imageDisabled);
    button.setStyle(style);
    button.pad(0, 0, 0, 0);// ww w. j a v a  2  s.c  o m
    addActor(button);
    button.setDisabled(true);
    TextTooltip t = new TextTooltip(tooltip, skin);
    button.addListener(t);
}

From source file:com.bladecoder.engineeditor.ui.ProjectToolbar.java

License:Apache License

private void addToolBarButton(Skin skin, ImageButton button, String icon, String text, String tooltip) {
    ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
    TextureRegion image = Ctx.assetManager.getIcon(icon);
    style.imageUp = new TextureRegionDrawable(image);

    try {//from   w  w w .j  a  v  a  2  s. c om
        TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");
        style.imageDisabled = new TextureRegionDrawable(imageDisabled);
    } catch (Exception e) {

    }

    button.setStyle(style);
    // button.row();
    // button.add(new Label(text, skin));

    add(button);
    button.setDisabled(true);
    TextTooltip t = new TextTooltip(tooltip, skin);
    button.addListener(t);
}