com.badlogic.gdx.scenes.scene2d.ui.TextTooltip Java Examples

The following examples show how to use com.badlogic.gdx.scenes.scene2d.ui.TextTooltip. 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: ProjectToolbar.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
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 {
		TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");

		if (imageDisabled != null)
			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);
}
 
Example #2
Source File: EditToolbar.java    From bladecoder-adventure-engine with Apache License 2.0 6 votes vote down vote up
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(6,3,6,3);
       addActor(button);
       button.setDisabled(true);
       TextTooltip t = new TextTooltip(tooltip, skin);
	button.addListener(t);
}
 
Example #3
Source File: InputPanel.java    From bladecoder-adventure-engine with Apache License 2.0 5 votes vote down vote up
protected void init(Skin skin, String title, String desc, Actor c, boolean mandatory, String defaultValue) {
	// debug();

	this.mandatory = mandatory;

	this.setSkin(skin);
	LabelStyle style = new LabelStyle(skin.get(LabelStyle.class));
	this.title = new Label(title, style);

	this.desc = new Label(desc, skin, "subtitle");
	this.desc.setWrap(false);

	this.field = c;

	// row().expand();
	float titleWidth = this.title.getStyle().font.getSpaceXadvance() * 35;
	add(this.title).width(titleWidth).left().top();
	this.title.setWidth(titleWidth);
	this.title.setWrap(true);
	// row().expand();
	add(field).expandX().left().top();

	if (USE_TOOLTIPS) {
		TextTooltip t = new TextTooltip(desc, skin);
		this.title.addListener(t);
		this.field.addListener(t);
	} else {
		row().expand();
		add(this.desc).colspan(2).left();
	}

	if (defaultValue != null)
		setText(defaultValue);
}
 
Example #4
Source File: BehaviorTreeViewer.java    From gdx-ai with Apache License 2.0 5 votes vote down vote up
public View (Task<?> task, Skin skin) {
	super(skin);
	this.name = new Label(task.getClass().getSimpleName(), skin);
	this.status = new Label("", skin);
	add(name);
	add(status).padLeft(10);
	StringBuilder attrs = new StringBuilder(task.getClass().getSimpleName()).append('\n');
	addListener(new TextTooltip(appendTaskAttributes(attrs, task).toString(), skin));
}