本文整理汇总了Java中com.kotcrab.vis.ui.widget.VisImageButton类的典型用法代码示例。如果您正苦于以下问题:Java VisImageButton类的具体用法?Java VisImageButton怎么用?Java VisImageButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisImageButton类属于com.kotcrab.vis.ui.widget包,在下文中一共展示了VisImageButton类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getActorByName
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
public Actor getActorByName(String name){
switch (name){
case "Group":
return new Group();
case "Label":
return new NativeLabel("",getMainFont());
case "CheckBox":
return new VisCheckBox("");
case "Image":
return new Image(assetManager.get("badlogic.jpg",Texture.class));
case "Button":
return new VisImageButton(VisUI.getSkin().get(VisImageButton.VisImageButtonStyle.class));
case "TextField":
return new TextField("",VisUI.getSkin());
default:
return new Actor();
}
}
示例2: build
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
@Override
public void build(Group group) {
pauseButtonTexture = new TextureRegionDrawable(new TextureRegion(new Texture("pause.png")));
backButtonTexture = new TextureRegionDrawable(new TextureRegion(new Texture("back.png")));
pauseButton = new VisImageButton(pauseButtonTexture);
pauseButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
((WorldSimulator)getController()).toggleOverlayMenu();
}
});
pauseButton.setWidth(widthVal.get(pauseButton));
pauseButton.setHeight(heightVal.get(pauseButton));
group.addActor(pauseButton);
}
示例3: addVisWidgets
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
private void addVisWidgets () {
Drawable icon = VisUI.getSkin().getDrawable("icon-folder");
VisImageButton normal = new VisImageButton(icon);
VisImageButton disabled = new VisImageButton(icon);
disabled.setGenerateDisabledImage(true);
disabled.setDisabled(true);
add(new VisLabel("VisImageButton normal"));
add(normal).row();
add(new VisLabel("VisImageButton disabled"));
add(disabled).row();
VisImageTextButton normalText = new VisImageTextButton("text", icon);
VisImageTextButton disabledText = new VisImageTextButton("text", icon);
disabledText.setGenerateDisabledImage(true);
disabledText.setDisabled(true);
add(new VisLabel("VisImageTextButton normal"));
add(normalText).row();
add(new VisLabel("VisImageTextButton disabled"));
add(disabledText).padBottom(3f).row();
}
示例4: parseUqAttr
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
public static void parseUqAttr(Actor actor, XmlReader.Element element){
Class cls = EditorManager.getInstance().getActorType(actor);
if (cls.equals(Label.class)){
parseLabel((Label) actor,element);
}else if (cls.equals(Image.class)){
parseImage((Image) actor,element);
}else if (cls.equals(Button.class)){
parseButton((VisImageButton) actor,element);
}else if (cls.equals(TextField.class)){
parseTextField((TextField) actor,element);
}
}
示例5: parseButton
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
public static void parseButton(VisImageButton button, XmlReader.Element element){
String upPath = element.get("up");
String downPath = element.get("down");
String checkPath = element.get("check");
Drawable up = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(upPath))));
Drawable down = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(downPath))));
Drawable checked = new TextureRegionDrawable(new TextureRegion(new Texture(Config.getImageFilePath(checkPath))));
VisImageButton.VisImageButtonStyle buttonStyle = new VisImageButton.VisImageButtonStyle(
up,down,checked,up,down,checked
);
button.setStyle(buttonStyle);
attr2Button(button, new String[]{upPath, downPath, checkPath});
}
示例6: validateApiKey
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
@LmlAction("validateApiKey") void validateApiKey() {
final VisWindow pleaseWaitDialog = (VisWindow) interfaceService.getParser().parseTemplate(Gdx.files.internal("lml/compression/dialogTinifyValidation.lml")).first();
final VisImageButton btnClose = WidgetUtils.obtainCloseButton(pleaseWaitDialog);
btnClose.setGenerateDisabledImage(true);
btnClose.setDisabled(true);
pleaseWaitDialog.setCenterOnAdd(true);
pleaseWaitDialog.pack();
stage.addActor(pleaseWaitDialog.fadeIn());
tinifyService.validateApiKey(new TinifyService.ValidationListener() {
@Override
public void onValid() {
Gdx.app.log(TAG, "Tinify API key validation succeed");
pleaseWaitDialog.findActor("groupChecking").setVisible(false);
pleaseWaitDialog.findActor("groupValid").setVisible(true);
pleaseWaitDialog.closeOnEscape();
btnClose.setDisabled(false);
}
@Override
public void onInvalid() {
Gdx.app.log(TAG, "Tinify API key validation failed");
pleaseWaitDialog.findActor("groupChecking").setVisible(false);
pleaseWaitDialog.findActor("groupInvalid").setVisible(true);
pleaseWaitDialog.closeOnEscape();
btnClose.setDisabled(false);
}
@Override
public void onError(Exception e) {
Gdx.app.error(TAG, "Error during Tinify API key validation", e);
pleaseWaitDialog.fadeOut();
errorDialogController.setError(e);
interfaceService.showDialog(errorDialogController.getClass());
}
});
}
示例7: createMainTable
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
protected void createMainTable () {
mainTable = new VisTable();
mainTable.setBackground(style.background);
VisImageButton closeButton = new VisImageButton(style.closeButtonStyle);
closeButton.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
close();
}
});
mainTable.add(contentTable).pad(3).fill().expand();
mainTable.add(closeButton).top();
}
示例8: process
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final VisImageButton actor,
final String rawAttributeData) {
final VisImageButtonStyle style = new VisImageButtonStyle(actor.getStyle());
style.imageUp = parser.getData().getDefaultSkin().getDrawable(parser.parseString(rawAttributeData, actor));
actor.setStyle(style);
}
示例9: getNewInstanceOfActor
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
@Override
protected Actor getNewInstanceOfActor(final LmlActorBuilder builder) {
final Skin skin = getSkin(builder);
final VisImageButton button = new VisImageButton(skin.get(builder.getStyleName(), VisImageButtonStyle.class));
button.setSkin(skin); // Not set internally by the constructor.
return button;
}
示例10: build
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
public VisImageButton build () {
VisImageButton button;
if (toolId != null) {
button = new ToolButton(icon.drawable(), text, toolId);
button.addListener(new EventButtonChangeListener(new ToolSwitchedEvent(toolId)));
} else {
button = new ToolbarButton(icon.drawable(), text, type);
if (toggle)
button.addListener(new VisChangeListener((changeEvent, actor) -> App.eventBus.post(new ToggleToolbarEvent(type, button.isChecked()))));
else
button.addListener(new EventButtonChangeListener(new ToolbarEvent(type)));
}
button.setGenerateDisabledImage(true);
button.setProgrammaticChangeEvents(false);
if (group != null) group.add(button);
if (toggle) {
button.getStyle().checked = VisUI.getSkin().getDrawable("button-down");
button.getStyle().focusBorder = null;
}
switch (policy) {
case SAVABLE:
savableScope.add(button);
break;
case SCENE:
sceneScope.add(button);
break;
case NONE:
break;
}
return button;
}
示例11: initShortCutTable
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
private void initShortCutTable(){
VisTable shortcutTable = new VisTable();
VisImageButton alignLeftBtn = new VisImageButton(new TextureRegionDrawable(new TextureRegion(
EditorManager.getInstance().assetManager.get("icon/align_left.png",Texture.class)
)));
alignLeftBtn.setUserObject(Align.left);
VisImageButton alignRightBtn = new VisImageButton(new TextureRegionDrawable(new TextureRegion(
EditorManager.getInstance().assetManager.get("icon/align_right.png",Texture.class)
)));
alignRightBtn.setUserObject(Align.right);
VisImageButton alignCenterBtn = new VisImageButton(new TextureRegionDrawable(new TextureRegion(
EditorManager.getInstance().assetManager.get("icon/align_center.png",Texture.class)
)));
alignCenterBtn.setUserObject(Align.center);
VisImageButton alignHCenterBtn = new VisImageButton(new TextureRegionDrawable(new TextureRegion(
EditorManager.getInstance().assetManager.get("icon/align_h_center.png",Texture.class)
)));
alignHCenterBtn.setUserObject(Config.centerH);
VisImageButton alignTopButton = new VisImageButton(new TextureRegionDrawable(new TextureRegion(
EditorManager.getInstance().assetManager.get("icon/align_top.png",Texture.class)
)));
alignTopButton.setUserObject(Align.top);
VisImageButton alignBottomButton = new VisImageButton(new TextureRegionDrawable(new TextureRegion(
EditorManager.getInstance().assetManager.get("icon/align_bottom.png",Texture.class)
)));
alignBottomButton.setUserObject(Align.bottom);
alignLeftBtn.addListener(alignClickListener);
alignRightBtn.addListener(alignClickListener);
alignCenterBtn.addListener(alignClickListener);
alignHCenterBtn.addListener(alignClickListener);
alignBottomButton.addListener(alignClickListener);
alignTopButton.addListener(alignClickListener);
shortcutTable.add(alignLeftBtn);
shortcutTable.add(alignRightBtn).spaceLeft(5);
shortcutTable.row();
shortcutTable.add(alignCenterBtn).spaceTop(5);
shortcutTable.add(alignHCenterBtn).spaceLeft(5).spaceTop(5);
shortcutTable.row();
shortcutTable.add(alignTopButton).spaceTop(5);
shortcutTable.add(alignBottomButton).spaceLeft(5).spaceTop(5);
this.add(shortcutTable).expand().left().padLeft(10).top().padTop(10);
}
示例12: obtainCloseButton
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
/** Obtains close button from {@link VisWindow} */
public static VisImageButton obtainCloseButton(VisWindow window) {
return (VisImageButton) window.getTitleTable().getChildren().peek();
}
示例13: getHandledType
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
@Override
public Class<VisImageButton> getHandledType() {
return VisImageButton.class;
}
示例14: process
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final VisImageButton actor,
final String rawAttributeData) {
actor.setGenerateDisabledImage(parser.parseBoolean(rawAttributeData, actor));
}
示例15: getComponentActors
import com.kotcrab.vis.ui.widget.VisImageButton; //导入依赖的package包/类
@Override
protected Actor[] getComponentActors(final Actor actor) {
return new Actor[] { ((VisImageButton) actor).getImage() };
}