Package tripleplay.ui

Examples of tripleplay.ui.Slider


    @Override protected String title () {
        return "UI: Scroller";
    }

    @Override protected Group createIface () {
        final Slider width = new Slider(100, 100, 5000);
        final Slider height = new Slider(100, 100, 5000);
        final Slider xpos = new Slider(0, 0, 1);
        final Slider ypos = new Slider(0, 0, 1);
        final Content content = new Content();
        final Scroller scroll = new Scroller(content);
        final Label click = new Label();

        // updates the size of the content
        final UnitSlot updateSize = new UnitSlot() {
            @Override public void onEmit () {
                ((Content)scroll.content).preferredSize.update(
                    width.value.get(), height.value.get());
            }
        };
        width.value.connect(updateSize);
        height.value.connect(updateSize);

        // updates the scroll offset
        UnitSlot updatePos = new UnitSlot() {
            @Override public void onEmit () {
                float x = xpos.value.get() * scroll.hrange.max();
                float y = ypos.value.get() * scroll.vrange.max();
                scroll.scroll(x, y);
            }
        };
        xpos.value.connect(updatePos);
        ypos.value.connect(updatePos);

        Button beh = new Button(Behavior.BOTH.name()).onClick(new Slot<Button>() {
            @Override public void onEmit (Button source) {
                Behavior[] behs = Behavior.values();
                Behavior beh = Behavior.valueOf(source.text.get());
                beh = behs[(beh.ordinal() + 1) % behs.length];
                scroll.setBehavior(beh);
                source.text.update(beh.name());
                xpos.setVisible(beh.hasHorizontal());
                ypos.setVisible(beh.hasVertical());
                updateSize.onEmit();
            }
        });

        scroll.contentClicked().connect(new Slot<Pointer.Event>() {
View Full Code Here


    @Override
    protected Group createIface () {
        final BoxPointWidget position = new BoxPointWidget("Position");
        final BoxPointWidget origin = new BoxPointWidget("Origin");
        final Slider width = new Slider(50, 10, 150);
        final Slider height = new Slider(50, 10, 150);
        Group sizeCtrl = new Group(AxisLayout.horizontal()).add(new Label("Size:"), width, height);
        final Group group = new Group(new AbsoluteLayout());
        group.layer.add(PlayN.graphics().createImmediateLayer(new ImmediateLayer.Renderer() {
            Point pt = new Point();
            @Override public void render (Surface surface) {
View Full Code Here

    @Override protected Group createIface () {
        Group iface = new Group(AxisLayout.vertical().gap(10)).add(
            new Shim(15, 15),
            new Label("Click and drag the slider to change the value:"),
            sliderAndLabel(new Slider(0, -100, 100), "-000"),
            new Shim(15, 15),
            new Label("This one counts by 2s:"),
            sliderAndLabel(new Slider(0, -50, 50).setIncrement(2).addStyles(
                Behavior.Track.HOVER_LIMIT.is(35f)), "-00"),
            new Shim(15, 15),
            new Label("With a background, custom bar and thumb image:"),
            sliderAndLabel(
                new Slider(0, -50, 50).addStyles(
                    Style.BACKGROUND.is(Background.roundRect(0xFFFFFFFF, 16).inset(4)),
                    Slider.THUMB_IMAGE.is(Icons.loader(
                        PlayN.assets().getImage("images/smiley.png"), 24, 24)),
                    Slider.BAR_HEIGHT.is(18f),
                    Slider.BAR_BACKGROUND.is(Background.roundRect(0xFFFF0000, 9))), "-00"));
View Full Code Here

        Button add10 = new Button("+10");
        Button add100 = new Button("+100");
        HistoryGroup.Labels history = new HistoryGroup.Labels();
        final SizableGroup historyBox = new SizableGroup(new BorderLayout());
        historyBox.add(history.setConstraint(BorderLayout.CENTER));
        Slider width = new Slider(150, 25, 1024);
        Group top = new Group(AxisLayout.horizontal()).add(
            prefix.setConstraint(AxisLayout.stretched()), add10, add100, width);
        width.value.connectNotify(new Slot<Float>() {
            @Override public void onEmit (Float val) {
                historyBox.preferredSize.updateWidth(val);
View Full Code Here

TOP

Related Classes of tripleplay.ui.Slider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.