本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.CheckBox.setChecked方法的典型用法代码示例。如果您正苦于以下问题:Java CheckBox.setChecked方法的具体用法?Java CheckBox.setChecked怎么用?Java CheckBox.setChecked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.CheckBox
的用法示例。
在下文中一共展示了CheckBox.setChecked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GraphicsOptions
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
public GraphicsOptions (Skin skin) {
setName("Graphics");
resolutionSelectBox = new SelectBox<String>(skin);
resolutionSelectBox.setItems(GameConfig.SUPPORTED_RESOLUTIONS);
resolutionSelectBox.setSelected(OrionPrefs.getString(StringValue.GRAPHICS_RESOLUTION));
fullscreenCheckBox = new CheckBox("Fullscreen", skin);
fullscreenCheckBox.setChecked(OrionPrefs.getBoolean(BooleanValue.GRAPHICS_FULLSCREEN));
TextButton applyButton = new TextButton("Apply", skin);
applyButton.addListener(new ChangeListener() {
@Override
public void changed (ChangeEvent event, Actor actor) {
OrionPrefs.putBoolean(BooleanValue.GRAPHICS_FULLSCREEN, fullscreenCheckBox.isChecked());
OrionPrefs.putString(StringValue.GRAPHICS_RESOLUTION, resolutionSelectBox.getSelected());
GameManager.refreshDisplayMode();
}
});
add(resolutionSelectBox);
row();
add(fullscreenCheckBox);
row();
add(applyButton);
}
示例2: AudioOptions
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
public AudioOptions (Skin skin) {
setName("Audio");
soundSlider = new Slider(0, 1, 0.05f, false, skin);
soundSlider.setValue(OrionPrefs.getFloat(FloatValue.AUDIO_SOUND_VOLUME));
musicSlider = new Slider(0, 1, 0.05f, false, skin);
musicSlider.setValue(OrionPrefs.getFloat(FloatValue.AUDIO_MUSIC_VOLUME));
musicCheckBox = new CheckBox("Music Enabled", skin);
musicCheckBox.setChecked(OrionPrefs.getBoolean(BooleanValue.AUDIO_MUSIC_ENABLED));
soundCheckBox = new CheckBox("Sound Enabled", skin);
soundCheckBox.setChecked(OrionPrefs.getBoolean(BooleanValue.AUDIO_MUSIC_ENABLED));
Table soundTable = new Table();
soundTable.add(soundSlider);
soundTable.add(soundCheckBox);
Table musicTable = new Table();
musicTable.add(musicSlider);
musicTable.add(musicCheckBox);
add(soundTable);
row();
add(musicTable);
}
示例3: addCheckBox
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
public boolean addCheckBox(final String label, final boolean checked, final Procedure1<Boolean> update) {
boolean _xblockexpression = false;
{
Label _createLabel = this.widgets.createLabel(label);
Cell<Label> _add = this.table.<Label>add(_createLabel);
this.defaultCellOptions(_add);
final CheckBox box = this.widgets.createCheckBox();
box.setChecked(checked);
Cell<CheckBox> _add_1 = this.table.<CheckBox>add(box);
this.defaultCellOptions(_add_1);
this.table.row();
final Procedure0 _function = new Procedure0() {
@Override
public void apply() {
boolean _isChecked = box.isChecked();
update.apply(Boolean.valueOf(_isChecked));
}
};
_xblockexpression = this.updateProcedures.add(_function);
}
return _xblockexpression;
}
示例4: a
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
private void a(Skin paramSkin, c[] paramArrayOfc)
{
int i = paramArrayOfc.length;
for (int j = 0; j < i; j++)
{
c localc = paramArrayOfc[j];
CheckBox localCheckBox = new CheckBox(localc.c, paramSkin);
localCheckBox.setChecked(localc.d);
localCheckBox.addListener(new b(this, localc, localCheckBox));
localCheckBox.left();
((com.a.a.c)localCheckBox.getCells().get(0)).j();
add(localCheckBox).a(Float.valueOf(0.85F), Float.valueOf(0.0F)).o().m().j(8.0F);
this.a.put(Integer.valueOf(localc.a), localCheckBox);
row();
}
}
示例5: createStaticMenu
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
private void createStaticMenu() {
Table container = new Table();
container.setFillParent(true);
container.top();
stage.addActor(container);
Label title = new Label("Configuration", uiSkin, "title");
Label musicLabel = new Label("Musique :", uiSkin);
CheckBox musicCheckBox = new CheckBox("", uiSkin);
musicCheckBox.setChecked(GlobalConfiguration.musicOn);
musicCheckBox.addListener(new MusicCheckBoxListener());
Label seedLabel = new Label("Seed :", uiSkin);
String configuredSeed = (GlobalConfiguration.configuredSeed == null) ? null : ""+GlobalConfiguration.configuredSeed;
TextField seedField = new TextField(configuredSeed, uiSkin);
TextButton saveButton = new TextButton("Sauvegarder", uiSkin);
saveButton.addListener(new SaveConfigListener(seedField, stage));
Label returnLabel = new Label("Menu", uiSkin);
returnLabel.addListener(new ButtonRedirectListener(game, new MainMenuScreen(game)));
Table actorContainer = new Table();
actorContainer.add(musicLabel);
actorContainer.add(musicCheckBox);
actorContainer.row().padTop(10);
actorContainer.add(seedLabel).padRight(10);
actorContainer.add(seedField);
actorContainer.row().padTop(10);
actorContainer.add(saveButton).colspan(2);
container.add(title).padTop(10);
container.row();
container.add(actorContainer).expand();
container.row();
container.add(returnLabel).bottom().left().pad(10);
}
示例6: GameSelectionDialog
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
public GameSelectionDialog(String title, Game game, Skin skin) {
super(title, skin);
this.game = game;
TextButton enterGameButton = new TextButton("Start", skin);
Label nameLabel = new Label("Dein Name", skin);
Label passwordLabel = new Label("Passwort", skin);
nameText = new TextFieldActor("", skin);
passwordText = new TextFieldActor("", skin);
CheckBox showPasswordCheckBox = new CheckBox("Passwort anzeigen", skin);
showPasswordCheckBox.right();
getButtonTable().defaults().width(175).height(100);
getContentTable().padTop(40);
getContentTable().add(nameLabel).center().row();
getContentTable().add(nameText).width(200).center().row();
getContentTable().add(passwordLabel).center().row();
getContentTable().add(passwordText).width(200).center().row();
getContentTable().add(showPasswordCheckBox).center().colspan(2).center();
getButtonTable().padTop(30);
button(enterGameButton, "Start");
passwordText.setPasswordCharacter('*');
passwordText.setPasswordMode(true);
showPasswordCheckBox.setChecked(false);
showPasswordCheckBox.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
passwordText.setPasswordMode(!passwordText.isPasswordMode());
}
});
}
示例7: TeacherLoginDialogActor
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
public TeacherLoginDialogActor(Skin skin) {
super("", skin);
teacherLoginDialog = new TeacherLoginDialog();
TextButton registerButton = new TextButton("Login", skin, "textButtonLarge");
Label userLabel = new Label("Username", skin);
Label passwordLabel = new Label("Password", skin);
TextField userText = teacherLoginDialog.getUserText();
final TextField passwordText = teacherLoginDialog.getPasswordText();
CheckBox showPasswordCheckBox = new CheckBox(" Show Password", skin);
showPasswordCheckBox.right();
getButtonTable().defaults().width(175).height(100);
getContentTable().padTop(40);
getContentTable().add(userLabel);
getContentTable().add(userText).row();
getContentTable().add(passwordLabel);
getContentTable().add(passwordText).row();
getContentTable().add(showPasswordCheckBox).colspan(2).center();
getButtonTable().padTop(50);
button(registerButton, "Login");
passwordText.setPasswordCharacter('*');
passwordText.setPasswordMode(true);
showPasswordCheckBox.setChecked(false);
showPasswordCheckBox.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
passwordText.setPasswordMode(!passwordText.isPasswordMode());
}
});
}
示例8: makeHapticFeedbackCheckbox
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
private CheckBox makeHapticFeedbackCheckbox() {
final CheckBox checkBox = FontManager.Roboto18.makeCheckBox("Vibrate on touch");
checkBox.setChecked(VibrateClickListener.isVibrateEnabled());
checkBox.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
VibrateClickListener.setVibrateEnabled(checkBox.isChecked());
preferences.putBoolean("vibrateOnTouch", checkBox.isChecked());
preferences.flush();
}
});
return checkBox;
}
示例9: addCheckBox
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
public void addCheckBox(String text, boolean checked, Consumer<Boolean> lis) {
CheckBoxStyle style = skin.get(CheckBoxStyle.class);
CheckBox cb = new CheckBox(text, style);
cb.setChecked(checked);
if (lis != null)
cb.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
lis.accept(Boolean.valueOf(cb.isChecked()));
}
});
table.add(cb).colspan(nbColumns).minHeight(cb.getMinHeight()).prefHeight(cb.getPrefHeight());
table.row();
}
示例10: addAlignOrientationToLinearVelocityController
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
protected void addAlignOrientationToLinearVelocityController (Table table, final SteeringActor character) {
CheckBox alignOrient = new CheckBox("Align orient.to velocity", container.skin);
alignOrient.setChecked(character.isIndependentFacing());
alignOrient.addListener(new ClickListener() {
@Override
public void clicked (InputEvent event, float x, float y) {
CheckBox checkBox = (CheckBox)event.getListenerActor();
character.setIndependentFacing(checkBox.isChecked());
}
});
table.add(alignOrient);
}
示例11: init
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
private void init() {
//开始界面控件初始化
mAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.START_SETTING);
mRangeAtlas = MyGdxGame.assetManager.getTextureAtlas(Constant.RANGE_WIDGET);
mStartBtn = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("startBtnUp")),
new TextureRegionDrawable(mAtlas.findRegion("startBtnDown")));
mSettingBtn = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("settingBtnUp")),
new TextureRegionDrawable(mAtlas.findRegion("settingBtnDown")));
mStartBtn.setSize(280, 100);
mSettingBtn.setSize(280, 100);
//输入姓名对话框
mInputnameDialog = new InputnameDialog(MyGdxGame.VIEW_WIDTH / 2, MyGdxGame.VIEW_HEIGHT / 2);
//警告对话框
mWarningDialog = new NameWarningDialog(MyGdxGame.SCREEN_WIDTH / 2, MyGdxGame.SCREEN_HEIGHT / 2);
//开始界面 - 排行榜
mRangeBtn = new ImageButton(new TextureRegionDrawable(mRangeAtlas.findRegion("rangeBtnUp")),
new TextureRegionDrawable(mRangeAtlas.findRegion("rangeBtnDown")));
mRangeBtn.setSize(280, 100);
//初始化排行榜对话框
mRangeDialog = new RankingDialog(MyGdxGame.SCREEN_WIDTH / 2, MyGdxGame.SCREEN_HEIGHT / 2);
mStartBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 20, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 20);
mRangeBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 100);
mSettingBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 180);
//设置界面初始化 - 是否打开音效
Drawable checkOn = new TextureRegionDrawable(mAtlas.findRegion("musicBtnOn"));
Drawable checkOff = new TextureRegionDrawable(mAtlas.findRegion("musicBtnOff"));
CheckBox.CheckBoxStyle boxStyle = new CheckBox.CheckBoxStyle(checkOff, checkOn,
MyGdxGame.assetManager.getFont(), Color.BLUE);
mCheckBox = new CheckBox("", boxStyle);
mCheckBox.setSize(255, 100);
mCheckBox.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 38, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 40);
if (isPlay) {
mCheckBox.setChecked(true);
} else {
mCheckBox.setChecked(false);
}
//设置界面初始化 - 关于我们
mAboutBtn = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("aboutBtnUp")),
new TextureRegionDrawable(mAtlas.findRegion("aboutBtnDown")));
mAboutBtn.setSize(280, 100);
mAboutBtn.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 110);
mAboutGameDialog = new AboutGameDialog(MyGdxGame.SCREEN_WIDTH / 2, MyGdxGame.SCREEN_HEIGHT / 2);
//设置界面初始化 - 返回按钮
mBackButton = new ImageButton(new TextureRegionDrawable(mAtlas.findRegion("backStartBtnUp")),
new TextureRegionDrawable(mAtlas.findRegion("backStartBtnDown")));
mBackButton.setSize(280, 100);
mBackButton.setPosition(MyGdxGame.VIEW_WIDTH / 2 + 26, MyGdxGame.VIEW_HEIGHT / 2 - mStartBtn.getHeight() / 2 - 180);
//背景音乐
if (isPlay) {
MyGdxGame.assetManager.getMusic(Constant.START_BGM).play();
} else {
MyGdxGame.assetManager.getMusic(Constant.START_BGM).pause();
}
//初始化监听
initListener();
}
示例12: show
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
@Override
public void show() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), new TextureAtlas("ui/atlas.pack"));
table = new Table(skin);
table.setFillParent(true);
final CheckBox vSyncCheckBox = new CheckBox("vSync", skin,"default");
vSyncCheckBox.setChecked(vSync());
final TextField levelDirectoryInput = new TextField(levelDirectory().path(), skin,"default"); // creating a new TextField with the current level directory already written in it
levelDirectoryInput.setMessageText("Nivel de directorio"); // set the text to be shown when nothing is in the TextField
final TextButton back = new TextButton("Atras", skin,"default");
back.pad(10);
ClickListener buttonHandler = new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
//AssetLoaderSpace.music_menu.stop();
// event.getListenerActor() returns the source of the event, e.g. a button that was clicked
if(event.getListenerActor() == vSyncCheckBox) {
// save vSync
Gdx.app.getPreferences(LittleNibolas.TITLE).putBoolean("vsync", vSyncCheckBox.isChecked());
// set vSync
Gdx.graphics.setVSync(vSync());
Gdx.app.log(LittleNibolas.TITLE, "vSync " + (vSync() ? "enabled" : "disabled"));
} else if(event.getListenerActor() == back) {
// save level directory
String actualLevelDirectory = levelDirectoryInput.getText().trim().equals("") ? Gdx.files.getExternalStoragePath() + LittleNibolas.TITLE + "/levels" : levelDirectoryInput.getText().trim(); // shortened form of an if-statement: [boolean] ? [if true] : [else] // String#trim() removes spaces on both sides of the string
Gdx.app.getPreferences(LittleNibolas.TITLE).putString("NivelDeDirectorio", actualLevelDirectory);
// save the settings to preferences file (Preferences#flush() writes the preferences in memory to the file)
Gdx.app.getPreferences(LittleNibolas.TITLE).flush();
Gdx.app.log(LittleNibolas.TITLE, "Configuración guardada");
stage.addAction(sequence(moveTo(0, stage.getHeight(), .5f), run(new Runnable() {
@Override
public void run() {
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu(game));
}
})));
}
}
};
vSyncCheckBox.addListener(buttonHandler);
back.addListener(buttonHandler);
// putting everything in the table
table.add(new Label("Opciones", skin, "big")).spaceBottom(50).colspan(3).expandX().row();
table.add();
table.add("Nivel de directorio");
table.add().row();
table.add(vSyncCheckBox).top().expandY();
table.add(levelDirectoryInput).top().fillX();
table.add(back).bottom().right();
stage.addActor(table);
stage.addAction(sequence(moveTo(0, stage.getHeight()), moveTo(0, 0, .5f))); // coming in from top animation
}
示例13: show
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
@Override
public void show() {
stage = new Stage();
Gdx.input.setInputProcessor(stage);
skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), new TextureAtlas("ui/atlas.pack"));
table = new Table(skin);
table.setFillParent(true);
final CheckBox vSyncCheckBox = new CheckBox("vSync", skin,"default");
vSyncCheckBox.setChecked(vSync());
final TextField levelDirectoryInput = new TextField(levelDirectory().path(), skin,"default"); // creating a new TextField with the current level directory already written in it
levelDirectoryInput.setMessageText("Nivel de directorio"); // set the text to be shown when nothing is in the TextField
final TextButton back = new TextButton("Atras", skin,"default");
back.pad(10);
ClickListener buttonHandler = new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
//AssetLoaderSpace.music_menu.stop();
// event.getListenerActor() returns the source of the event, e.g. a button that was clicked
if(event.getListenerActor() == vSyncCheckBox) {
// save vSync
Gdx.app.getPreferences(LittleNibolas.TITLE).putBoolean("vsync", vSyncCheckBox.isChecked());
// set vSync
Gdx.graphics.setVSync(vSync());
Gdx.app.log(LittleNibolas.TITLE, "vSync " + (vSync() ? "enabled" : "disabled"));
} else if(event.getListenerActor() == back) {
// save level directory
String actualLevelDirectory = levelDirectoryInput.getText().trim().equals("") ? Gdx.files.getExternalStoragePath() + LittleNibolas.TITLE + "/levels" : levelDirectoryInput.getText().trim(); // shortened form of an if-statement: [boolean] ? [if true] : [else] // String#trim() removes spaces on both sides of the string
Gdx.app.getPreferences(LittleNibolas.TITLE).putString("NivelDeDirectorio", actualLevelDirectory);
// save the settings to preferences file (Preferences#flush() writes the preferences in memory to the file)
Gdx.app.getPreferences(LittleNibolas.TITLE).flush();
Gdx.app.log(LittleNibolas.TITLE, "Configuración guardada");
stage.addAction(sequence(moveTo(0, stage.getHeight(), .5f), run(new Runnable() {
@Override
public void run() {
((Game) Gdx.app.getApplicationListener()).setScreen(new MainMenu());
}
})));
}
}
};
vSyncCheckBox.addListener(buttonHandler);
back.addListener(buttonHandler);
// putting everything in the table
table.add(new Label("Opciones", skin, "big")).spaceBottom(50).colspan(3).expandX().row();
table.add();
table.add("Nivel de directorio");
table.add().row();
table.add(vSyncCheckBox).top().expandY();
table.add(levelDirectoryInput).top().fillX();
table.add(back).bottom().right();
stage.addActor(table);
stage.addAction(sequence(moveTo(0, stage.getHeight()), moveTo(0, 0, .5f))); // coming in from top animation
}
示例14: initialize
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
@Override
public void initialize() {
computeGaiaScan = new CheckBox(" " + txt("gui.gaiascan.enable"), skin);
computeGaiaScan.setName("compute gaia scan");
computeGaiaScan.addListener(event -> {
if (event instanceof ChangeEvent) {
EventManager.instance.post(Events.COMPUTE_GAIA_SCAN_CMD, txt("gui.gaiascan.compute"), computeGaiaScan.isChecked());
return true;
}
return false;
});
computeGaiaScan.setChecked(GlobalConf.scene.COMPUTE_GAIA_SCAN);
transitColor = new CheckBox(" " + txt("gui.gaiascan.colour"), skin);
transitColor.setName("transit color");
transitColor.addListener(event -> {
if (event instanceof ChangeEvent) {
EventManager.instance.post(Events.TRANSIT_COLOUR_CMD, txt("gui.gaiascan.transit"), transitColor.isChecked());
return true;
}
return false;
});
transitColor.setChecked(GlobalConf.scene.STAR_COLOR_TRANSIT);
// onlyObservedStars = new CheckBox(txt("gui.gaiascan.onlyobserved"), skin);
// onlyObservedStars.setName("only observed stars");
// onlyObservedStars.addListener(new EventListener() {
// @Override
// public boolean handle(Event event) {
// if (event instanceof ChangeEvent) {
// EventManager.instance.post(Events.ONLY_OBSERVED_STARS_CMD, txt("gui.gaiascan.only"), onlyObservedStars.isChecked());
// return true;
// }
// return false;
// }
// });
// onlyObservedStars.setChecked(GlobalConf.scene.ONLY_OBSERVED_STARS);
VerticalGroup gaiaGroup = new VerticalGroup().align(Align.left).columnAlign(Align.left);
gaiaGroup.addActor(computeGaiaScan);
gaiaGroup.addActor(transitColor);
//gaiaGroup.addActor(onlyObservedStars);
component = gaiaGroup;
}
示例15: getDialog
import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; //导入方法依赖的package包/类
@Override
public Dialog getDialog(Object... arguments) {
// First argument is the title of the dialog
String dialogTitle = (String) arguments[0];
// Second and last argument is the body of the dialog
String dialogMessage = (String) arguments[1];
// Third argument should be a ConfirmationDialogClosedListener
closedListener = (ConfirmationDialogClosedListener) arguments[2];
// Fourth argument is optional. If present, should be a
// ConfirmationDialogClosedListener,
// meaning a checkbox should be added to the dialog.
String checkboxText = null;
if (arguments.length > 3) {
checkboxListener = (ConfirmationDialogCheckboxListener) arguments[3];
// Fifth argument is also optional: the text for the checkbox
checkboxText = (String) arguments[4];
}
Skin skin = controller.getApplicationAssets().getSkin();
I18N i18N = controller.getApplicationAssets().getI18N();
dialogController = new DialogController(skin);
// Main part of the dialog
LinearLayout messageContainer = new LinearLayout(false);
Label text = new Label(dialogMessage, skin);
text.setWidth(LABEL_WIDTH);
text.setWrap(true);
messageContainer.add(text).top();
// If required, add a checkbox
if (checkboxListener != null) {
final CheckBox checkBox = new CheckBox(checkboxText, skin);
checkBox.setChecked(checkboxListener.isMarked());
checkBox.addListener(new EventListener() {
@Override
public boolean handle(Event event) {
Gdx.app.debug(
this.getClass().getCanonicalName(),
"Notifying a change in checkbox:"
+ checkBox.isChecked());
checkboxListener.checkboxChanged(checkBox.isChecked());
return true;
}
});
messageContainer.add(checkBox).top();
}
Dialog dialog = dialogController.title(dialogTitle)
.content(messageContainer).getDialog();
dialogController.button(i18N.m("general.ok"),
new DialogController.DialogButtonListener() {
@Override
public void selected() {
buttonActivated(true);
}
});
dialogController.button(i18N.m("general.cancel"),
new DialogController.DialogButtonListener() {
@Override
public void selected() {
buttonActivated(false);
}
});
dialog.setWidth(DIALOG_WIDTH);
return dialog;
}