当前位置: 首页>>代码示例>>Java>>正文


Java Spinner类代码示例

本文整理汇总了Java中com.kotcrab.vis.ui.widget.spinner.Spinner的典型用法代码示例。如果您正苦于以下问题:Java Spinner类的具体用法?Java Spinner怎么用?Java Spinner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Spinner类属于com.kotcrab.vis.ui.widget.spinner包,在下文中一共展示了Spinner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildNumberSelector

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public <T> Spinner buildNumberSelector(ConfigurableAttribute<T> attr) {
    Integer min = getValue(Integer.class, attr.params().get("min"));
    Integer max = getValue(Integer.class, attr.params().get("max"));
    Integer precision = getValue(Integer.class, attr.params().get("precision"));

    SimpleFloatSpinnerModel model = new SimpleFloatSpinnerModel(Float.parseFloat(attr.get().toString()), min, max, 1, precision);

    Spinner spinner = new Spinner("", model);

    fixVisSpinners(spinner);

    spinner.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            attr.setSafe(model.getValue()+"");
        }
    });

    return spinner;
}
 
开发者ID:ncguy2,项目名称:Argent,代码行数:22,代码来源:GDXComponentBuilder.java

示例2: onSettingsIntSpinnerChanged

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("onSettingsIntSpinnerChanged") void onSettingsIntSpinnerChanged(Spinner spinner) {
    PackModel pack = getSelectedPack();
    if (pack == null) return;

    TexturePacker.Settings settings = pack.getSettings();
    IntSpinnerModel model = (IntSpinnerModel) spinner.getModel();
    switch (spinner.getName()) {
        case "spnMinPageWidth": settings.minWidth = model.getValue(); break;
        case "spnMinPageHeight": settings.minHeight = model.getValue(); break;
        case "spnMaxPageWidth": settings.maxWidth = model.getValue(); break;
        case "spnMaxPageHeight": settings.maxHeight = model.getValue(); break;
        case "spnAlphaThreshold": settings.alphaThreshold = model.getValue(); break;
        case "spnPaddingX": settings.paddingX = model.getValue(); break;
        case "spnPaddingY": settings.paddingY = model.getValue(); break;
    }
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:17,代码来源:MainController.java

示例3: updateLeftPadFromView

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateLeftPadFromView") void updateLeftPadFromView(Spinner spinner) {
    GridValues gridValues = getActiveGridValues();
    IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();

    int maxValue = model.texture.getWidth() - gridValues.right.get() - 1;
    if (spinnerModel.getValue() > maxValue) {
        spinnerModel.setValue(maxValue);
        return;
    }
    gridValues.left.set(spinnerModel.getValue());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例4: updateRightPadFromView

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateRightPadFromView") void updateRightPadFromView(Spinner spinner) {
    GridValues gridValues = getActiveGridValues();
    IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();

    int maxValue = model.texture.getWidth() - gridValues.left.get() - 1;
    if (spinnerModel.getValue() > maxValue) {
        spinnerModel.setValue(maxValue);
        return;
    }
    gridValues.right.set(spinnerModel.getValue());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例5: updateBottomPadFromView

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateBottomPadFromView") void updateBottomPadFromView(Spinner spinner) {
    GridValues gridValues = getActiveGridValues();
    IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();

    int maxValue = model.texture.getHeight() - gridValues.top.get() - 1;
    if (spinnerModel.getValue() > maxValue) {
        spinnerModel.setValue(maxValue);
        return;
    }
    gridValues.bottom.set(spinnerModel.getValue());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例6: updateTopPadFromView

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@LmlAction("updateTopPadFromView") void updateTopPadFromView(Spinner spinner) {
    GridValues gridValues = getActiveGridValues();
    IntSpinnerModel spinnerModel = (IntSpinnerModel) spinner.getModel();

    int maxValue = model.texture.getHeight() - gridValues.bottom.get() - 1;
    if (spinnerModel.getValue() > maxValue) {
        spinnerModel.setValue(maxValue);
        return;
    }
    gridValues.top.set(spinnerModel.getValue());
}
 
开发者ID:crashinvaders,项目名称:gdx-texture-packer-gui,代码行数:12,代码来源:NinePatchEditorDialog.java

示例7: process

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
    if (!(actor.getModel() instanceof ArraySpinnerModel<?>)) {
        parser.throwErrorIfStrict(
                "Spinner array attribute is available only for spinners with ArraySpinnerModel. Found array attribute on tag: "
                        + tag.getTagName());
        return;
    }
    final ArraySpinnerModel<Object> model = (ArraySpinnerModel<Object>) actor.getModel();
    model.getItems().addAll((Object[]) parser.fullyParseArray(rawAttributeData, actor));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:13,代码来源:SpinnerArrayLmlAttribute.java

示例8: determinePolicy

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
/**
 * @param parser parses the tag.
 * @param actor requires text field event policy..
 * @param rawAttributeData unparsed attribute's value.
 * @return chosen {@link FileChooser.FileSorting}. Throws exception if ID not valid and parser is strict; returns
 * default value if parser not strict.
 */
protected Spinner.TextFieldEventPolicy determinePolicy(final LmlParser parser, final Spinner actor,
        final String rawAttributeData) {
    final String modeName = Strings.toUpperCase(parser.parseString(rawAttributeData, actor).trim());
    try {
        return Spinner.TextFieldEventPolicy.valueOf(modeName);
    } catch (final Exception exception) {
        // Unknown ID.
        parser.throwErrorIfStrict("Unable to determine text field event policy with data: " + rawAttributeData,
                exception);
    }
    return Spinner.TextFieldEventPolicy.ON_FOCUS_LOST;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:20,代码来源:SpinnerTextFieldEventPolicyLmlAttribute.java

示例9: process

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
    LmlUtilities.getLmlUserObject(actor).addOnCloseAction(new ActorConsumer<Void, Object>() {
        @Override
        public Void consume(final Object spinner) {
            final SpinnerModel model = actor.getModel();
            if (model instanceof IntSpinnerModel) {
                ((IntSpinnerModel) model).setValue(parser.parseInt(rawAttributeData, actor), false);
            } else if (model instanceof FloatSpinnerModel) {
                try {
                    ((FloatSpinnerModel) model)
                            .setValue(new BigDecimal(parser.parseString(rawAttributeData, actor)), false);
                } catch (final NumberFormatException exception) {
                    parser.throwErrorIfStrict("Invalid numeric value: " + rawAttributeData, exception);
                }
            } else if (model instanceof SimpleFloatSpinnerModel) {
                ((SimpleFloatSpinnerModel) model).setValue(parser.parseFloat(rawAttributeData, actor), false);
            } else if (model instanceof ArraySpinnerModel<?>) {
                ((ArraySpinnerModel<?>) model).setCurrent(parser.parseInt(rawAttributeData, actor), false);
            } else {
                parser.throwErrorIfStrict("Unknown model: " + model + ". Unable to select value.");
            }
            actor.notifyValueChanged(false);
            return null;
        }
    });
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:28,代码来源:SpinnerSelectedLmlAttribute.java

示例10: process

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
    final SpinnerModel model = actor.getModel();
    final int precision = parser.parseInt(rawAttributeData, actor);
    if (model instanceof FloatSpinnerModel) {
        ((FloatSpinnerModel) model).setScale(precision);
    } else if (model instanceof SimpleFloatSpinnerModel) {
        ((SimpleFloatSpinnerModel) model).setPrecision(precision);
    } else {
        parser.throwErrorIfStrict(
                "Precision (scale) attribute can be used only for spinners with models storing decimal values. Found attribute in tag: "
                        + tag.getTagName());
    }
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:15,代码来源:SpinnerPrecisionLmlAttribute.java

示例11: getHandledType

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public Class<Spinner> getHandledType() {
    return Spinner.class;
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:SpinnerArrayLmlAttribute.java

示例12: process

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(LmlParser parser, LmlTag tag, Spinner spinner, String rawAttributeData) {
    spinner.setTextFieldEventPolicy(determinePolicy(parser, spinner, rawAttributeData));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:SpinnerTextFieldEventPolicyLmlAttribute.java

示例13: process

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
    actor.getModel().setWrap(parser.parseBoolean(rawAttributeData, actor));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:SpinnerWrapLmlAttribute.java

示例14: process

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
    actor.setProgrammaticChangeEvents(parser.parseBoolean(rawAttributeData, actor));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:SpinnerProgrammaticChangeEventsLmlAttribute.java

示例15: process

import com.kotcrab.vis.ui.widget.spinner.Spinner; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final Spinner actor, final String rawAttributeData) {
    actor.setSelectorName(parser.parseString(rawAttributeData, actor));
}
 
开发者ID:czyzby,项目名称:gdx-lml,代码行数:5,代码来源:SpinnerNameLmlAttribute.java


注:本文中的com.kotcrab.vis.ui.widget.spinner.Spinner类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。