Java 类com.badlogic.gdx.scenes.scene2d.ui.CheckBox 实例源码

项目:retro-reversi    文件:DifficultyMenuView.java   
private void addPieceChoice(){
    buttonTable = new Table();
    buttonTable.bottom();
    buttonTable.setFillParent(true);

    pieceChoiceGroup = new ButtonGroup<CheckBox>();
    whiteCheckBox = new CheckBox(" White", game.getSkin());
    blackCheckBox = new CheckBox(" Black", game.getSkin());
    pieceChoiceGroup.add(blackCheckBox);
    pieceChoiceGroup.add(whiteCheckBox);
    pieceChoiceGroup.setMaxCheckCount(1);
    pieceChoiceGroup.setMinCheckCount(1);
    pieceChoiceGroup.setUncheckLast(true);
    pieceChoiceGroup.setChecked("Black");

    buttonTable.add(whiteCheckBox).center().padBottom(15).row();
    buttonTable.add(blackCheckBox).center().padBottom(40).row();
}
项目:GDXJam    文件:OptionsDialog.java   
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);
}
项目:GDXJam    文件:OptionsDialog.java   
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);

}
项目:abattle    文件:OptionTable.java   
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;
}
项目:libgdxcn    文件:MipMapTest.java   
private void createUI () {
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    ui = new Stage();

    String[] filters = new String[TextureFilter.values().length];
    int idx = 0;
    for (TextureFilter filter : TextureFilter.values()) {
        filters[idx++] = filter.toString();
    }
    hwMipMap = new CheckBox("Hardware Mips", skin);
    minFilter = new SelectBox(skin);
    minFilter.setItems(filters);
    magFilter = new SelectBox(skin.get(SelectBoxStyle.class));
    magFilter.setItems("Nearest", "Linear");

    Table table = new Table();
    table.setSize(ui.getWidth(), 30);
    table.setY(ui.getHeight() - 30);
    table.add(hwMipMap).spaceRight(5);
    table.add(new Label("Min Filter", skin)).spaceRight(5);
    table.add(minFilter).spaceRight(5);
    table.add(new Label("Mag Filter", skin)).spaceRight(5);
    table.add(magFilter);

    ui.addActor(table);
}
项目:GdxStudio    文件:Serializer.java   
public static void setup(){
    registerSerializer(Actor.class, new ActorSerializer());
    registerSerializer(Scene.class, new SceneSerializer());
    registerSerializer(ImageJson.class, new ImageJson());
    registerSerializer(Label.class, new LabelSerializer());
    registerSerializer(Button.class, new ButtonSerializer());
    registerSerializer(TextButton.class, new TextButtonSerializer());
    registerSerializer(Table.class, new TableSerializer());
    registerSerializer(CheckBox.class, new CheckBoxSerializer());
    registerSerializer(SelectBox.class, new SelectBoxSerializer());
    registerSerializer(List.class, new ListSerializer());
    registerSerializer(Slider.class, new SliderSerializer());
    registerSerializer(TextField.class, new TextFieldSerializer());
    registerSerializer(Touchpad.class, new TouchpadSerializer());
    registerSerializer(Sprite.class, new SpriteSerializer());

    registerSerializer(Dialog.class, new DialogSerializer());
    registerSerializer(SplitPane.class, new SplitPaneSerializer());
    registerSerializer(ScrollPane.class, new ScrollPaneSerializer());
    registerSerializer(Stack.class, new StackSerializer());
    registerSerializer(Tree.class, new TreeSerializer());
    registerSerializer(Table.class, new TableSerializer());
    registerSerializer(ButtonGroup.class, new ButtonGroupSerializer());
    registerSerializer(HorizontalGroup.class, new HorizontalGroupSerializer());
    registerSerializer(VerticalGroup.class, new VerticalGroupSerializer());
}
项目:ead    文件:EmptyRendererEditor.java   
public EmptyRendererEditor(Controller control) {
    this.controller = control;
    float pad = WidgetBuilder.dpToPixels(8);
    pad(pad);

    ApplicationAssets applicationAssets = controller.getApplicationAssets();
    Skin skin = applicationAssets.getSkin();
    setBackground(skin.getDrawable(SkinConstants.DRAWABLE_PAGE));

    add(hitAll = new CheckBox(applicationAssets.getI18N().m("hit.all"),
            skin));
    hitAll.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            EmptyRenderer emptyRenderer = Q.getComponent(modelEntity,
                    EmptyRenderer.class);
            controller.action(SetField.class, emptyRenderer,
                    FieldName.HIT_ALL, hitAll.isChecked());
        }
    });
}
项目:ingress-indonesia-dev    文件:a.java   
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();
  }
}
项目:MMORPG_Prototype    文件:ChoosingCharacterDialog.java   
private void addCharacterPosition(UserCharacterDataPacket character)
{
    characters.add(character);
    text(character.getNickname());
    text(character.getLevel().toString());
    CheckBox checkBox = new CheckBox("", Settings.DEFAULT_SKIN);
    checkBox.setName(character.getNickname());
    checkBoxes.add(checkBox);
    getContentTable().add(checkBox);
    getContentTable().row();
}
项目:rectball    文件:RectballSkin.java   
private void addCheckboxStyles() {
    Texture sheet = game.manager.get("ui/switch.png");
    int width = sheet.getWidth();
    int height = sheet.getHeight() / 3;
    TextureRegion broken = new TextureRegion(sheet, 0, 0, width, height);
    TextureRegion on = new TextureRegion(sheet, 0, height, width, height);
    TextureRegion off = new TextureRegion(sheet, 0, 2 * height, width, height);

    CheckBox.CheckBoxStyle style = new CheckBox.CheckBoxStyle();
    style.checkboxOn = new TextureRegionDrawable(on);
    style.checkboxOff = new TextureRegionDrawable(off);
    style.checkboxOnDisabled = style.checkboxOffDisabled = new TextureRegionDrawable(broken);
    style.font = get("normal", BitmapFont.class);
    add("default", style);
}
项目:Opus-Prototype    文件:AContinentForm.java   
public AContinentForm(Skin skin, AbstractSampler sampler, Samplers pool) {
    super(skin, sampler, pool);

    inputTable = new InputTable(skin);
    inputTable.setBackground(Styles.INNER_BACKGROUND);
    inputTable.addEntry(NAME_ITERATIONS, 60);
    inputTable.addEntry(NAME_GROWTH, 60);
    inputTable.addEntry(NAME_SIZE, 60);
    inputTable.addEntry(NAME_EDGE, 60);

    inputTable.setEntryValueListener(new InputTable.EntryValueListener() {
        @Override
        public void onChange(String entryName, String entryValue) {
            notifyChanges();
        }
    });

    add(inputTable);

    row();
    cbSmoothEdge = new CheckBox("Smooth edge", skin);
    cbSmoothEdge.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            notifyChanges();
        }
    });
    add(cbSmoothEdge);
}
项目:Point-and-Hit    文件:OptionsScreen.java   
private CheckBox newRadioButton(String text) {
    CheckBox radioButton = new CheckBox(text, checkBoxStyle);
    radioButton.getImageCell().pad(20 * scale);
    radioButton.getImageCell().size(
            radioButton.getImageCell().getPrefWidth()
            * scale);
    return radioButton;
}
项目:RottenCave    文件:ConfigurationScreen.java   
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);
}
项目:gdx-lml    文件:MainView.java   
/** @param checkBox will have its text changed. */
public void switchCase(final CheckBox checkBox) {
    if (checkBox.isChecked()) {
        checkBox.setText(checkBox.getText().toString().toUpperCase());
    } else {
        checkBox.setText(checkBox.getText().toString().toLowerCase());
    }
}
项目:Terminkalender    文件:GameSelectionDialog.java   
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());
        }
    });
}
项目:Terminkalender    文件:CreateGameDialogActor.java   
public CreateGameDialogActor(Skin skin) {
    super("", skin);
    createGameDialog = new CreateGameDialog();

    TextButton createGameButton = new TextButton("Create Game", skin, "textButtonLarge");
    Label gameNameLabel = new Label("Game Name", skin);
    Label gamePasswordLabel = new Label("Password", skin);
    Label gamePasswordRepeatLabel = new Label("Repeat password", skin);
    TextField gameNameText = createGameDialog.getGameNameText();
    final TextField gamePasswordText = createGameDialog.getGamePasswordText();
    final TextField gamePasswordRepeatText = createGameDialog.getGamePasswordRepeatText();
    CheckBox showPasswordCheckBox = new CheckBox("  Show Password", skin);

    getButtonTable().defaults().width(175).height(100);

    getContentTable().padTop(40);
    getContentTable().add(gameNameLabel);
    getContentTable().add(gameNameText).row();
    getContentTable().add(gamePasswordLabel);
    getContentTable().add(gamePasswordText).row();
    getContentTable().add(gamePasswordRepeatLabel);
    getContentTable().add(gamePasswordRepeatText).row();
    getContentTable().add(showPasswordCheckBox).colspan(2).center();
    getButtonTable().padTop(50);
    button(createGameButton, "Register");

    gamePasswordText.setPasswordCharacter('*');
    gamePasswordText.setPasswordMode(true);
    gamePasswordRepeatText.setPasswordCharacter('*');
    gamePasswordRepeatText.setPasswordMode(true);

    showPasswordCheckBox.addListener(new ChangeListener() {
        public void changed (ChangeEvent event, Actor actor) {
            gamePasswordText.setPasswordMode(!gamePasswordText.isPasswordMode());
            gamePasswordRepeatText.setPasswordMode(!gamePasswordRepeatText.isPasswordMode());
        }
    });
}
项目:Terminkalender    文件:TeacherRegisterDialogActor.java   
public TeacherRegisterDialogActor(Skin skin) {
    super("", skin);
    teacherRegisterDialog = new TeacherRegisterDialog(); 

    TextButton registerButton = new TextButton("Register", skin, "textButtonLarge");
    Label userLabel = new Label("Username", skin);
    Label passwordLabel = new Label("Password", skin);
    Label passwordRepeatLabel = new Label("Repeat password", skin);
    TextField userText = teacherRegisterDialog.getUserText();
    final TextField passwordText = teacherRegisterDialog.getPasswordText();
    final TextField passwordRepeatText = teacherRegisterDialog.getPasswordRepeatText();
    CheckBox showPasswordCheckBox = new CheckBox("  Show Password", skin);

    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(passwordRepeatLabel);
    getContentTable().add(passwordRepeatText).row();
    getContentTable().add(showPasswordCheckBox).colspan(2).center();
    getButtonTable().padTop(50);
    button(registerButton, "Register");

    passwordText.setPasswordCharacter('*');
    passwordText.setPasswordMode(true);
    passwordRepeatText.setPasswordCharacter('*');
    passwordRepeatText.setPasswordMode(true);

    showPasswordCheckBox.addListener(new ChangeListener() {
        public void changed (ChangeEvent event, Actor actor) {
            passwordText.setPasswordMode(!passwordText.isPasswordMode());
            passwordRepeatText.setPasswordMode(!passwordRepeatText.isPasswordMode());
        }
    });
}
项目:Terminkalender    文件:TeacherLoginDialogActor.java   
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());
        }
    });
}
项目:droidtowers    文件:OptionsDialog.java   
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;
}
项目:droidtowers    文件:DataOverlayPopOver.java   
private void buildControls() {
    boolean unlockedJanitors = AchievementEngine.instance().findById("build5commercialspaces").hasGivenReward();
    boolean unlockedMaids = AchievementEngine.instance().findById("build8hotelroom").hasGivenReward();

    for (final Overlays overlay : Overlays.values()) {
        if (overlay.equals(Overlays.DIRT_LEVEL) && (!unlockedJanitors || !unlockedMaids)) {
            continue;
        }

        final CheckBox checkBox = FontManager.Roboto18.makeCheckBox(overlay.toString());
        checkBox.align(Align.left);
        checkBox.getLabelCell().padLeft(0).spaceLeft(Display.devicePixel(8));
        checkBox.addListener(new VibrateClickListener() {
            public void onClick(InputEvent event, float x, float y) {
                if (checkBox.isChecked()) {
                    for (Actor otherCheckbox : getActors()) {
                        if (otherCheckbox instanceof CheckBox && otherCheckbox != checkBox) {
                            ((CheckBox) otherCheckbox).setChecked(false);
                        }
                    }

                    gameGridRenderer.setActiveOverlay(overlay);
                } else {
                    gameGridRenderer.setActiveOverlay(null);
                }
            }
        });

        Image colorSwatch = new Image(drawable(TowerAssetManager.WHITE_SWATCH), Scaling.stretch);
        colorSwatch.setColor(overlay.getColor(1f));

        row().left();
        add(checkBox).pad(0).fillX();
        add(colorSwatch).width(16).height(16);
    }
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
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();
}
项目:GdxStudio    文件:StudioPanel.java   
public void createActor(String type){
    switch(type){
        case "Label":
            if(Asset.fontMap.size != 0){
                LabelStyle ls = new LabelStyle();
                ls.font = Asset.fontMap.firstValue();
                Label label = new Label("Text", ls);
                setName(label);
            }
            break;
        case "Image":
            if(Asset.texMap.size != 0){
                setName(new ImageJson(Asset.texMap.firstKey()));
            }
            break;
        case "Texture":setName(new ImageJson(Content.assetPanel.list.getSelectedValue()));break;
        case "Sprite":setName(new Sprite(1f, Asset.texMap.firstKey()));break;
        case "Particle":
            //ParticleEffect pe = new ParticleEffect();
            //pe.load(effectFile, imagesDir);
            break;

        case "Button":setName(new Button(Asset.skin));break;
        case "TextButton":setName(new TextButton("Text", Asset.skin));break;
        case "TextField":setName(new TextField("", Asset.skin));break;
        case "Table":setName(new Table(Asset.skin));break;
        case "CheckBox":setName(new CheckBox("Check", Asset.skin));break;
        case "SelectBox":setName(new SelectBox(new String[]{"First","Second","Third"}, Asset.skin));break;
        case "List":setName(new List(new String[]{"First","Second","Third"}, Asset.skin));break;
        case "Slider":setName(new Slider(0, 10, 1, false, Asset.skin));break;
        case "Dialog":setName(new Dialog("Title", Asset.skin));break;
        case "Touchpad":setName(new Touchpad(5, Asset.skin));break;
        case "Map":setName(new Map(1, 24));break;
        case "None":break;
        default:break;
    }
}
项目:GdxStudio    文件:Serializer.java   
@Override
public void write(Json json, Actor check, Class arg2) {
    json.writeObjectStart();
    writeActor(json, check);
    json.writeValue("text", ((CheckBox)check).getText().toString());
    json.writeObjectEnd();
}
项目:Vloxlands    文件:PinnableWindow.java   
public PinnableWindow(String title, Skin skin) {
    super(title, skin);
    pin = new CheckBox("", Vloxlands.skin);
    TextButton x = new TextButton("X", Vloxlands.skin, "image");
    x.addListener(new HidingClickListener(this));
    getButtonTable().add(pin).height(getPadTop()).width(getPadTop());
    getButtonTable().add(x).size(40).padRight(4);
}
项目:OneStory_VN_Engine    文件:OptionLayer.java   
private void init() {
    Skin skin   = SkinService.getSkin();
    ok          = new TextButton("Ok", skin, "choice");
    sfxVolume   = new Slider(0, 1f, 0.1f, false, skin);
    musicVolume = new Slider(0, 1f, 0.1f, false, skin);
    enableDebug = new CheckBox("", skin);
}
项目:gdx-ai    文件:Scene2dSteeringTest.java   
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);
}
项目:ead    文件:OptionsController.java   
/**
 * Creates a boolean option
 * 
 * @param field
 *            the name for the option
 */
public BooleanController bool(String field) {
    Option option = panel.bool(label(field), tooltip(field));
    CheckBox checkBox = (CheckBox) option.getOptionWidget();
    BooleanController value = newValueController(BooleanController.class,
            checkBox);
    add(field, option, value);
    return value;
}
项目:ingress-indonesia-dev    文件:a.java   
public final void a(int paramInt, boolean paramBoolean)
{
  CheckBox localCheckBox = (CheckBox)this.a.get(Integer.valueOf(paramInt));
  if (localCheckBox == null)
    return;
  localCheckBox.setChecked(paramBoolean);
}
项目:SuperUI    文件:UITools.java   
public static CheckBox checkbox(String text) {
    checkSkin();

    return new CheckBox(text, skin);
}
项目:libGdx-xiyou    文件:Start.java   
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();
}
项目:skin-composer    文件:StyleData.java   
public void resetProperties() {
    properties.clear();

    if (clazz.equals(Button.class)) {
        newStyleProperties(ButtonStyle.class);
    } else if (clazz.equals(CheckBox.class)) {
        newStyleProperties(CheckBoxStyle.class);
        properties.get("checkboxOn").optional = false;
        properties.get("checkboxOff").optional = false;
        properties.get("font").optional = false;
    } else if (clazz.equals(ImageButton.class)) {
        newStyleProperties(ImageButtonStyle.class);
    } else if (clazz.equals(ImageTextButton.class)) {
        newStyleProperties(ImageTextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(Label.class)) {
        newStyleProperties(LabelStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(List.class)) {
        newStyleProperties(ListStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColorSelected").optional = false;
        properties.get("fontColorUnselected").optional = false;
        properties.get("selection").optional = false;
    } else if (clazz.equals(ProgressBar.class)) {
        newStyleProperties(ProgressBarStyle.class);

        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(ScrollPane.class)) {
        newStyleProperties(ScrollPaneStyle.class);
    } else if (clazz.equals(SelectBox.class)) {
        newStyleProperties(SelectBoxStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
        properties.get("scrollStyle").optional = false;
        properties.get("scrollStyle").value = "default";
        properties.get("listStyle").optional = false;
        properties.get("listStyle").value = "default";
    } else if (clazz.equals(Slider.class)) {
        newStyleProperties(SliderStyle.class);

        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(SplitPane.class)) {
        newStyleProperties(SplitPaneStyle.class);
        properties.get("handle").optional = false;
    } else if (clazz.equals(TextButton.class)) {
        newStyleProperties(TextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(TextField.class)) {
        newStyleProperties(TextFieldStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
    } else if (clazz.equals(TextTooltip.class)) {
        newStyleProperties(TextTooltipStyle.class);
        properties.get("label").optional = false;
        properties.get("label").value = "default";
    } else if (clazz.equals(Touchpad.class)) {
        newStyleProperties(TouchpadStyle.class);
    } else if (clazz.equals(Tree.class)) {
        newStyleProperties(TreeStyle.class);
        properties.get("plus").optional = false;
        properties.get("minus").optional = false;
    } else if (clazz.equals(Window.class)) {
        newStyleProperties(WindowStyle.class);
        properties.get("titleFont").optional = false;
    }
}
项目:abattle    文件:Widgets.java   
public CheckBox createCheckBox() {
  Skin _skin = this.manager.getSkin();
  return new CheckBox("", _skin);
}
项目:gdx-lml    文件:CheckBoxLmlTag.java   
@Override
protected CheckBox getNewInstanceOfTextButton(final TextLmlActorBuilder builder) {
    return new CheckBox(builder.getText(), getSkin(builder), builder.getStyleName());
}
项目:gdx-lml    文件:CheckBoxLmlTag.java   
@Override
protected Actor[] getComponentActors(final Actor actor) {
    final CheckBox checkBox = (CheckBox) actor;
    return new Actor[] { checkBox.getLabel(), checkBox.getImage() };
}
项目:Little-Nibolas    文件:Settings.java   
@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
}
项目:Little-Nibolas    文件:Settings.java   
@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
}
项目:libgdxcn    文件:TableTest.java   
@Override
public void create () {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);

    skin = new Skin(Gdx.files.internal("data/uiskin.json"));

    texture = new Texture(Gdx.files.internal("data/badlogic.jpg"));
    TextureRegion region = new TextureRegion(texture);

    NinePatch patch = skin.getPatch("default-round");

    Label label = new Label("This is some text.", skin);

    root = new Table() {
        public void draw (Batch batch, float parentAlpha) {
            super.draw(batch, parentAlpha);
        }
    };
    stage.addActor(root);
    // root.setTransform(true);

    Table table = new Table();
    table.setTransform(true);
    table.setPosition(100, 100);
    table.setOrigin(0, 0);
    table.setRotation(45);
    table.setScaleY(2);
    table.add(label);
    table.add(new TextButton("Text Button", skin));
    table.pack();
    // table.debug();
    table.addListener(new ClickListener() {
        public void clicked (InputEvent event, float x, float y) {
            System.out.println("click!");
        }
    });
    root.addActor(table);

    TextButton button = new TextButton("Text Button", skin);
    Table table2 = new Table();
    // table2.debug()
    table2.add(button);
    table2.setTransform(true);
    table2.setScaleX(1.5f);
    table2.setOrigin(table2.getPrefWidth() / 2, table2.getPrefHeight() / 2);

    root.setPosition(10, 10);
    // root.debug();
    root.add(new Label("meow meow meow meow meow meow meow meow meow meow meow meow", skin)).colspan(3);
    root.row();
    root.add(table2).expand();
    root.add(new TextButton("Toggle Button", skin.get("toggle", TextButtonStyle.class)));
    root.add(new CheckBox("meow", skin));
    root.pack();
    // root.add(new Button(new Image(region), skin));
    // root.add(new LabelButton("Toggley", skin.getStyle("toggle", LabelButtonStyle.class)));
}
项目:droidtowers    文件:FontHelper.java   
public CheckBox makeCheckBox(String labelText) {
    return applyTextButtonLabelStyle(new CheckBox(labelText, TowerAssetManager.getCustomSkin()), Color.WHITE);
}
项目:droidtowers    文件:TowerAssetManager.java   
private static void makeCustomGUISkin() {
    ResolutionIndependentAtlas skinAtlas = new ResolutionIndependentAtlas(Gdx.files.internal("hud/skin.txt"));

    int size = 4;
    NinePatchDrawable buttonNormal = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button"), size, size, size, size));
    NinePatchDrawable buttonDown = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button-down"), size, size, size, size));
    NinePatchDrawable buttonDisabled = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button"), size, size, size, size));
    buttonDisabled.getPatch().getColor().a = 0.75f;

    customSkin = new Skin();

    CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle();
    checkBoxStyle.checkboxOn = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("checkbox-on")));
    checkBoxStyle.checkboxOff = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("checkbox-off")));
    checkBoxStyle.font = FontManager.Default.getFont();
    checkBoxStyle.fontColor = Color.WHITE;
    customSkin.add("default", checkBoxStyle);

    Slider.SliderStyle sliderStyle = new Slider.SliderStyle(new NinePatchDrawable(new NinePatch(new Texture(WHITE_SWATCH), Color.LIGHT_GRAY)),
            new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("slider-handle"))));
    customSkin.add("default-horizontal", sliderStyle);

    TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.up = buttonNormal;
    textButtonStyle.font = FontManager.Roboto18.getFont();
    textButtonStyle.fontColor = Color.WHITE;
    textButtonStyle.down = buttonDown;
    textButtonStyle.downFontColor = Color.WHITE;
    textButtonStyle.disabled = buttonDisabled;

    customSkin.add("default", textButtonStyle);

    textButtonStyle = new TextButton.TextButtonStyle();
    textButtonStyle.up = buttonNormal;
    textButtonStyle.font = FontManager.Roboto18.getFont();
    textButtonStyle.fontColor = Color.WHITE;
    textButtonStyle.down = buttonDown;
    textButtonStyle.downFontColor = Color.WHITE;
    textButtonStyle.checked = buttonDown;
    textButtonStyle.checkedFontColor = Color.WHITE;

    customSkin.add("toggle-button", textButtonStyle);

    TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle();
    textFieldStyle.background = buttonNormal;
    textFieldStyle.font = FontManager.Roboto18.getFont();
    textFieldStyle.fontColor = Color.WHITE;
    textFieldStyle.messageFont = FontManager.Roboto18.getFont();
    textFieldStyle.messageFontColor = Color.LIGHT_GRAY;
    textFieldStyle.cursor = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("text-cursor"), size, size, size, size));
    textFieldStyle.selection = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("text-selection")));

    customSkin.add("default", textFieldStyle);

    SelectBox.SelectBoxStyle selectBoxStyle = new SelectBox.SelectBoxStyle();
    selectBoxStyle.background = buttonNormal;
    selectBoxStyle.font = FontManager.Roboto18.getFont();
    selectBoxStyle.fontColor = Color.WHITE;
    selectBoxStyle.listStyle = new List.ListStyle();
    selectBoxStyle.background = buttonNormal;
    selectBoxStyle.listStyle.selection = buttonDown;

    customSkin.add("default", selectBoxStyle);
}
项目:GdxStudio    文件:Serializer.java   
@Override
public Actor read(Json json, JsonValue jv, Class arg2) {
    CheckBox check = new CheckBox(jv.getString("text"), Asset.skin);
    readActor(jv, check);
    return check;
}