Example usage for com.badlogic.gdx.scenes.scene2d.ui TextTooltip TextTooltip

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

Introduction

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

Prototype

public TextTooltip(String text, TextTooltipStyle 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);/*from ww  w . j a  v a2 s.  co  m*/
    button.pad(0, 0, 0, 0);
    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 {/*  w w  w .ja  v a 2  s  .  com*/
        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);
}

From source file:org.shadebob.skineditor.dialog.DrawablePickerDialog.java

License:Apache License

void updateTableActor() {
    tableDrawables.clear();/*from   ww  w.  jav a 2s. co m*/

    Iterator<String> keys = styleNamesMap.keys().iterator();
    int count = 0;
    while (keys.hasNext()) {
        final String styleName = keys.next();
        Button buttonItem = new Button(game.skin);
        Image img = null;
        if (styleNamesMap.get(styleName) instanceof Drawable) {
            img = new Image((Drawable) styleNamesMap.get(styleName));
        } else {
            img = new Image((TextureRegion) styleNamesMap.get(styleName));
        }
        if (zoom == true) {
            buttonItem.add(img).expand().fill().pad(5);
        } else {
            buttonItem.add(img).expand().pad(5);
        }
        String objectType = styleNamesMap.get(styleName).getClass().getSimpleName();
        objectType = objectType.replace("Drawable", "");
        buttonItem.row();
        buttonItem.add(styleName).getActor().setEllipsis(true);
        buttonItem.row();
        buttonItem.add(objectType, "title").getActor().setEllipsis(true);
        buttonItem.row();
        buttonItem.setClip(true);

        buttonItem.addListener(new TextTooltip(styleName, game.skin));
        buttonItem.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                super.clicked(event, x, y);
                if (field == null) {
                    return;
                }
                try {
                    // Since we have reloaded everything we have to get
                    // field back

                    // game.screenMain.paneOptions.refreshSelection();
                    if (styleNamesMap.get(styleName) instanceof Drawable) {
                        field.set(game.screenMain.paneOptions.currentStyleObj, styleNamesMap.get(styleName));
                    } else {
                        boolean ninepatch = false;
                        FileHandle test = new FileHandle("projects/" + game.screenMain.getcurrentProject()
                                + "/assets/" + styleName + ".9.png");
                        if (test.exists() == true) {
                            ninepatch = true;
                        }
                        if (ninepatch) {
                            game.skinProject.add(styleName, new NinePatchDrawable(
                                    new NinePatch((TextureRegion) styleNamesMap.get(styleName))));
                            field.set(game.screenMain.paneOptions.currentStyleObj,
                                    game.skinProject.getDrawable(styleName));
                        } else {
                            game.skinProject.add(styleName, new SpriteDrawable(
                                    new Sprite((TextureRegion) styleNamesMap.get(styleName))));
                            field.set(game.screenMain.paneOptions.currentStyleObj,
                                    game.skinProject.getDrawable(styleName));
                        }
                    }

                    game.screenMain.changeSkin();
                    hide();
                    game.screenMain.panePreview.refresh();
                    game.screenMain.paneOptions.updateSelectedTableFields();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
        tableDrawables.add(buttonItem).width(140).height(160).pad(5);
        if (count == 5) {
            count = 0;
            tableDrawables.row();
            continue;
        }
        count++;
    }
}