本文整理汇总了Java中com.kotcrab.vis.ui.widget.VisTextButton.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java VisTextButton.addListener方法的具体用法?Java VisTextButton.addListener怎么用?Java VisTextButton.addListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.kotcrab.vis.ui.widget.VisTextButton
的用法示例。
在下文中一共展示了VisTextButton.addListener方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initialize
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
@Override
protected void initialize() {
Table topButtonBar = new Table();
topButtonBar.setFillParent(true);
VisTextButton showEditorButton = new VisTextButton("Show Editor");
showEditorButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
showEditorClicked();
}
});
topButtonBar.top().left().add(showEditorButton).pad(7);
Table bottomButtonBar = new Table();
bottomButtonBar.setFillParent(true);
stage.addActor(topButtonBar);
}
示例2: buildTable
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
@Override
public void buildTable () {
prepareTable();
exporterSelector = new VisSelectBox<>();
exporterSelector.setItems(exporters);
VisTextButton exporterSettingsButton = new VisTextButton("Settings");
settingsTable.defaults().left();
settingsTable.add(TableBuilder.build(new VisLabel("Exporter"), exporterSelector, exporterSettingsButton));
exporterSettingsButton.addListener(new VisChangeListener((event, actor) -> {
UUID uuid = getUUIDForName(exporterSelector.getSelected());
ExporterPlugin exporter = exportersManager.getExportersMap().get(uuid);
if (exporter.isSettingsUsed() == false)
Dialogs.showOKDialog(stage, "Message", "This exporter does not have any additional settings");
else
exporter.showSettings();
}));
}
示例3: createUI
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
@Override
protected void createUI () {
defaults().left();
left();
detailsTextArea = new VisTextArea();
add(new VisLabel("Internal exception occurred in VisEditor, would you like to send\nissue report to VisEditor team to help fix this problem?")).row();
add(new VisLabel("Describe what happened: (optional)")).row();
add(detailsTextArea).height(140).growX().row();
VisTextButton sendButton = new VisTextButton("Send");
add(sendButton).right();
sendButton.addListener(new VisChangeListener((event, actor) -> {
sendReport();
fadeOut();
}));
}
示例4: createUI
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
@Override
protected void createUI () {
defaults().left();
left();
hullTolerance = new VisSlider(100, 400, 10, false);
hullTolerance.setValue(250);
alphaTolerance = new VisSlider(0, 255, 5, false);
alphaTolerance.setValue(128);
add(new VisLabel("Hull Tolerance"));
add(hullTolerance);
add().growX().row();
add(new VisLabel("Alpha Tolerance"));
add(alphaTolerance);
add().growX().row();
add(new VisLabel("Auto tracer does not support multi-part images,\nnote that creating points manually will be more precise.")).colspan(3).row();
VisTextButton traceButton = new VisTextButton("Trace");
VisTextButton closeButton = new VisTextButton("Close");
add(TableBuilder.build(traceButton, closeButton)).colspan(3).right();
traceButton.addListener(new VisChangeListener((event, actor) -> tracePolygon()));
closeButton.addListener(new VisChangeListener((event, actor) -> fadeOut()));
}
示例5: init
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
@Override
public void init () {
VisTextButton importButton = new VisTextButton("Import", "blue");
importButton.addListener(new VisChangeListener((event, actor) -> stage.addActor(new SpriterImportDialog(animFolder, relativePath).fadeIn())));
importTable = new VisTable();
importTable.pad(3);
importTable.add(new VisLabel("Spriter animation requires importing before use")).padRight(4);
importTable.add(importButton);
importTable.add().expandX().fillX();
VisTextButton updateButton = new VisTextButton("Update", "blue");
updateButton.addListener(new VisChangeListener((event, actor) ->
Async.startTask(stage, "Updating Animation", new UpdateAnimationAsyncTask())));
updateTable = new VisTable();
updateTable.pad(3);
updateTable.add(new VisLabel("Apply animation update?")).padRight(4);
updateTable.add(updateButton);
updateTable.add().expandX().fillX();
}
示例6: show
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
@Override
public void show() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
VisUI.load();
CenteredTableBuilder tableBuilder = new CenteredTableBuilder(new Padding(2, 3));
VisLabel heading = new VisLabel("Credits");
heading.setColor(Color.BLACK);
tableBuilder.append(heading).row();
stage.addActor(heading);
VisLabel temp = new VisLabel("To Be Implemented");
temp.setColor(Color.BLACK);
tableBuilder.append(temp).row();
stage.addActor(temp);
VisTextButton backButton = new VisTextButton("Back");
backButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen());
}
});
tableBuilder.append(backButton).row();
stage.addActor(backButton);
Table table = tableBuilder.build();
table.setFillParent(true);
stage.addActor(table);
}
示例7: show
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
@Override
public void show() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
VisUI.load();
CenteredTableBuilder tableBuilder = new CenteredTableBuilder(new Padding(2, 3));
VisLabel heading = new VisLabel("Options");
heading.setColor(Color.BLACK);
tableBuilder.append(heading).row();
stage.addActor(heading);
VisLabel temp = new VisLabel("To Be Implemented");
temp.setColor(Color.BLACK);
tableBuilder.append(temp).row();
stage.addActor(temp);
VisTextButton backButton = new VisTextButton("Back");
backButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenuScreen());
}
});
tableBuilder.append(backButton).row();
stage.addActor(backButton);
Table table = tableBuilder.build();
table.setFillParent(true);
stage.addActor(table);
}
示例8: createToggleBtn
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
private void createToggleBtn() {
btnGroup = new ButtonGroup<VisTextButton>();
tglBtnDec = new VisTextButton("Dec", "toggle");
tglBtnMin = new VisTextButton("Min", "toggle");
tglBtnSec = new VisTextButton("Sec", "toggle");
tglBtnUtm = new VisTextButton("UTM", "toggle");
tglBtnDec.addListener(tglListener);
tglBtnMin.addListener(tglListener);
tglBtnSec.addListener(tglListener);
tglBtnUtm.addListener(tglListener);
btnGroup.add(tglBtnDec);
btnGroup.add(tglBtnMin);
btnGroup.add(tglBtnSec);
btnGroup.add(tglBtnUtm);
Table tglTbl = new Table();
tglTbl.defaults().space(CB.scaledSizes.MARGIN / 4);
float btnWidth = (Gdx.graphics.getWidth() - CB.scaledSizes.MARGIN * 3) / 4;
tglTbl.add(tglBtnDec).width(new Value.Fixed(btnWidth));
tglTbl.add(tglBtnMin).width(new Value.Fixed(btnWidth));
tglTbl.add(tglBtnSec).width(new Value.Fixed(btnWidth));
tglTbl.add(tglBtnUtm).width(new Value.Fixed(btnWidth));
this.add(tglTbl).top().width(new Value.Fixed(Gdx.graphics.getWidth() - CB.scaledSizes.MARGINx2));
}
示例9: TestColorPicker
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
public TestColorPicker () {
super("color picker");
final Image image = new Image(white);
picker = new ColorPicker("color picker", new ColorPickerAdapter() {
@Override
public void finished (Color newColor) {
image.setColor(newColor);
}
});
VisTextButton showPickerButton = new VisTextButton("show color picker");
showPickerButton.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
getStage().addActor(picker.fadeIn());
}
});
Color c = new Color(27 / 255.0f, 161 / 255.0f, 226 / 255.0f, 1);
picker.setColor(c);
image.setColor(c);
TableUtils.setSpacingDefaults(this);
add(showPickerButton);
add(image).size(32).pad(3);
pack();
setPosition(948, 148);
}
示例10: PluginDetailsDialog
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
public PluginDetailsDialog (PluginDescriptor descriptor) {
super("Plugin Details");
setModal(true);
addCloseButton();
closeOnEscape();
TableUtils.setSpacingDefaults(this);
VisTable contentTable = new VisTable(false);
contentTable.defaults().spaceBottom(2).expand().left();
contentTable.add(new VisLabel("Name: " + descriptor.name + " (" + descriptor.id + ")")).row();
contentTable.add(new VisLabel("Description: " + descriptor.description)).row();
contentTable.add(new VisLabel("Provider: " + descriptor.provider)).row();
contentTable.add(new VisLabel("Version: " + descriptor.version)).row();
contentTable.add(new VisLabel("Compatibility: " + descriptor.compatibility + " " +
(descriptor.compatibility != App.PLUGIN_COMPATIBILITY_CODE ? "(doesn't matches editor!)" : "(matches editor)"))).row();
VisTextButton okButton;
add(contentTable).pad(3).expand().fill().row();
add(okButton = new VisTextButton("OK")).right();
okButton.addListener(new VisChangeListener((event, actor) -> fadeOut()));
pack();
setSize(getWidth(), getHeight());
centerWindow();
}
示例11: rebuildUsagesTable
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
private void rebuildUsagesTable () {
usagesTable.clear();
usagesTable.left();
usagesTable.defaults().left();
for (FileItem item : items) {
FileHandle file = item.getFile();
boolean canAnalyze = usageAnalyzer.canAnalyzeUsages(file);
if (canAnalyze == false) {
usagesTable.add(new VisLabel("Can't analyze usages for: '" + file.name() + "'"));
usagesTable.row();
} else {
AssetsUsages usages = usageAnalyzer.analyzeUsages(file);
usagesTable.add(new VisLabel(usages.toPrettyString()));
if (usages.count() > 0) {
VisTextButton viewUsages = new VisTextButton("View " + usages.file.name() + " Usages");
usagesTable.add(viewUsages);
viewUsages.addListener(new VisChangeListener((event, actor) -> openSpecificUsagesTab(usages)));
}
usagesTable.row();
}
}
}
示例12: NumPad
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
public NumPad(IKeyEventListener keyEventListener, OptionalButton... options) {
this.targetWidth = Gdx.graphics.getWidth();
this.keyEventListener = keyEventListener;
boolean ok = false, cancel = false, dot = false, delBack = false;
for (OptionalButton option : options) {
switch (option) {
case OK:
ok = true;
break;
case CANCEL:
cancel = true;
break;
case DOT:
dot = true;
break;
case DelBack:
delBack = true;
break;
}
}
hasOk = ok;
hasCancel = cancel;
hasDot = dot;
hasDelBack = delBack;
btn0 = new VisTextButton("0");
btn1 = new VisTextButton("1");
btn2 = new VisTextButton("2");
btn3 = new VisTextButton("3");
btn4 = new VisTextButton("4");
btn5 = new VisTextButton("5");
btn6 = new VisTextButton("6");
btn7 = new VisTextButton("7");
btn8 = new VisTextButton("8");
btn9 = new VisTextButton("9");
btnBack = new VisTextButton("Back");
btnDel = new VisTextButton("Del");
btnOk = new CharSequenceButton(Translation.get("ok"));
btnCancel = new CharSequenceButton(Translation.get("cancel"));
btnDot = new VisTextButton(".");
btnLeft = new VisTextButton("<");
btnRight = new VisTextButton(">");
btn0.addListener(clickListener);
btn1.addListener(clickListener);
btn2.addListener(clickListener);
btn3.addListener(clickListener);
btn4.addListener(clickListener);
btn5.addListener(clickListener);
btn6.addListener(clickListener);
btn7.addListener(clickListener);
btn8.addListener(clickListener);
btn9.addListener(clickListener);
btnBack.addListener(clickListener);
btnDel.addListener(clickListener);
btnOk.addListener(clickListener);
btnCancel.addListener(clickListener);
btnDot.addListener(clickListener);
btnLeft.addListener(clickListener);
btnRight.addListener(clickListener);
StageManager.registerForBackKey(clickListener);
}
示例13: initUI
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
private void initUI () {
uiTable = new VisTable(true) {
@Override
public float getPrefHeight () {
return 120;
}
};
uiTable.setBackground(VisUI.getSkin().getDrawable("window-bg"));
uiTable.setTouchable(Touchable.enabled);
uiTable.top().left();
uiTable.defaults().expandX().fillX().left();
uiTable.add(new VisLabel("Polygon Tool", Align.center)).expandX().fillX().top();
uiTable.row();
statusLabel = new VisLabel();
statusLabel.setWrap(true);
statusLabel.setAlignment(Align.center);
buttonTable = new VisTable(true) {
@Override
public float getPrefHeight () {
if (isVisible())
return super.getPrefHeight();
else
return 0;
}
@Override
public void setVisible (boolean visible) {
super.setVisible(visible);
invalidateHierarchy();
}
};
VisTextButton makeDefaultButton;
buttonTable.setVisible(false);
buttonTable.add(makeDefaultButton = new VisTextButton("Set From Bounds")).row();
buttonTable.add(traceButton = new VisTextButton("Auto Trace")).row();
dynamicUpdateCheck = new VisCheckBox("Dynamic faces update", true);
uiTable.add(statusLabel).pad(0, 3, 0, 3).height(new VisValue(context -> statusLabel.isVisible() ? statusLabel.getPrefHeight() : 0)).spaceBottom(0).row();
uiTable.add(buttonTable).height(new VisValue(context -> buttonTable.isVisible() ? buttonTable.getPrefHeight() : 0)).spaceBottom(0).row();
uiTable.add().expand().fill().row();
uiTable.add(dynamicUpdateCheck).expand(false, false).fill(false, false).center().padBottom(3);
makeDefaultButton.addListener(new VisChangeListener((event, actor) -> makeDefaultPolygon()));
traceButton.addListener(new VisChangeListener((event, actor) -> {
EntityProxy entity = entityManipulator.getSelectedEntities().first();
VisAssetDescriptor assetDescriptor = entity.getComponent(AssetReference.class).getAsset();
if (assetDescriptor instanceof TextureAssetDescriptor == false) {
Dialogs.showOKDialog(stage, "Message", "Auto Trace can only be used with sprite entities");
return;
}
if (entity.getRotation() != 0) {
Optional<DisableableOptionDialog> dialog = disableableDialogs.showOptionDialog(DisableableDialogsModule.POLYGON_TOOL_ROTATED_UNSUPPORTED, DefaultDialogOption.YES, stage, "Warning",
"Auto tracer does not support rotated entities",
OptionDialogType.YES_CANCEL, new OptionDialogAdapter() {
@Override
public void yes () {
showAutoTracerDialog(entity, assetDescriptor);
}
});
dialog.ifPresent(optDialog -> optDialog.setYesButtonText("Continue Anyway"));
} else {
showAutoTracerDialog(entity, assetDescriptor);
}
}));
}
示例14: LoadingAssetsFailedDialog
import com.kotcrab.vis.ui.widget.VisTextButton; //导入方法依赖的package包/类
public LoadingAssetsFailedDialog (ImmutableArray<FailedAssetDescriptor> descriptors) {
super("Failed Assets Details");
TableUtils.setSpacingDefaults(this);
addCloseButton();
closeOnEscape();
setModal(true);
VisTable list = new VisTable(true);
list.defaults().top();
list.top().left();
Array<VisAssetDescriptor> addedDescriptors = new Array<>();
for (FailedAssetDescriptor desc : descriptors) {
boolean alreadyAdded = false;
for (VisAssetDescriptor addedDesc : addedDescriptors) {
if (addedDesc.compare(desc.asset)) {
alreadyAdded = true;
break;
}
}
if (alreadyAdded) continue;
addedDescriptors.add(desc.asset);
VisTextButton detailsButton = new VisTextButton("Details");
detailsButton.addListener(new VisChangeListener((event, actor) -> getStage().addActor(new DetailsDialog(desc.throwable).fadeIn())));
list.add(desc.asset.toString()).left().expandX().fillX();
list.add(detailsButton).padRight(5);
list.row();
}
add("Following assets couldn't be loaded:").left().row();
VisScrollPane scrollPane = new VisScrollPane(list);
scrollPane.setOverscroll(false, true);
scrollPane.setFadeScrollBars(false);
add(scrollPane).top().size(500, 300);
pack();
centerWindow();
}