Package tripleplay.ui

Examples of tripleplay.ui.Label


            }));
        }
        root.add(buttons);

        buttons = new Group(AxisLayout.horizontal());
        buttons.add(new Label("HAlign:"));
        for (final Style.HAlign halign : Style.HAlign.values()) {
            buttons.add(new Button(halign.toString().substring(0, 1)).onClick(new UnitSlot() {
                @Override public void onEmit () { panel.addStyles(Style.HALIGN.is(halign)); }
            }));
        }

        buttons.add(new Label("VAlign:"));
        for (final Style.VAlign valign : Style.VAlign.values()) {
            buttons.add(new Button(valign.toString().substring(0, 1)).onClick(new UnitSlot() {
                @Override public void onEmit () { panel.addStyles(Style.VALIGN.is(valign)); }
            }));
        }
View Full Code Here


        return root;
    }

    public Element<?> create (ElemType type) {
        switch (type) {
        case SMILE: return new Label(_smiley);
        case SMILE_TEXT: return new Label("Some Text", _smiley);
        case TEXT: return new Label("Blah blah blah");
        case BUTTON: return new Button("Click to Foo");
        default: throw new AssertionError();
        }
    }
View Full Code Here

    @Override protected Group createIface () {
        Group group = new Group(AxisLayout.vertical(),
                                Style.BACKGROUND.is(Background.solid(0xFF000000)));
        if (graphics().ctx() == null) {
            group.add(new Label("Particles are only supported with GL/WebGL.").
                      addStyles(Style.COLOR.is(0xFFFFFFFF)));
        }
        return group;
    }
View Full Code Here

    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) {
                IDimension size = group.size();
                position.point.get().resolve(size, pt);
                surface.save();
                surface.setFillColor(Colors.BLACK);
                surface.fillRect(pt.x - 2, pt.y - 2, 5, 5);
                surface.restore();
            }
        }).setDepth(1));
        group.addStyles(Style.BACKGROUND.is(Background.solid(Colors.WHITE)));
        final Group widget = new Group(AxisLayout.horizontal()).addStyles(
            Style.BACKGROUND.is(Background.solid(Colors.CYAN)));
        group.add(widget);
        UnitSlot updateConstraint = new UnitSlot() {
            @Override public void onEmit () {
                widget.setConstraint(new AbsoluteLayout.Constraint(
                    position.point.get(), origin.point.get(),
                    new Dimension(width.value.get(), height.value.get())));
            }
        };
        width.value.connect(updateConstraint);
        height.value.connect(updateConstraint);
        position.point.connect(updateConstraint);
        origin.point.connect(updateConstraint);
        updateConstraint.onEmit();
        return new Group(AxisLayout.vertical().offStretch()).add(
            new Label("Move the sliders to play with the constraint"),
            new Group(AxisLayout.horizontal()).add(position, origin),
            sizeCtrl, group.setConstraint(AxisLayout.stretched()));
    }
View Full Code Here

    @Override protected Group createIface () {
        return new Group(AxisLayout.vertical(), Style.HALIGN.center).add(
            new Group(new TableLayout(TableLayout.COL.fixed().alignRight(),
                                      TableLayout.COL.fixed().alignLeft()).gaps(1, 5)).add(
                new Label("White"), createLabel(Colors.WHITE),
                new Label("Light Gray"), createLabel(Colors.LIGHT_GRAY),
                new Label("Gray"), createLabel(Colors.GRAY),
                new Label("Dark Gray"), createLabel(Colors.DARK_GRAY),
                new Label("Black"), createLabel(Colors.BLACK),
                new Label("Red"), createLabel(Colors.RED),
                new Label("Pink"), createLabel(Colors.PINK),
                new Label("Orange"), createLabel(Colors.ORANGE),
                new Label("Yellow"), createLabel(Colors.YELLOW),
                new Label("Green"), createLabel(Colors.GREEN),
                new Label("Magenta"), createLabel(Colors.MAGENTA),
                new Label("Cyan"), createLabel(Colors.CYAN),
                new Label("Blue"), createLabel(Colors.BLUE)));
    }
View Full Code Here

                new Label("Cyan"), createLabel(Colors.CYAN),
                new Label("Blue"), createLabel(Colors.BLUE)));
    }

    protected Label createLabel (int baseColor) {
        return new Label(createSampler(baseColor));
    }
View Full Code Here

            nx = new Slider(0, 0, 1), ny = new Slider(0, 0, 1),
            ox = new Slider(0, 0, 100), oy = new Slider(0, 0, 100);

        public BoxPointWidget (String label) {
            setLayout(AxisLayout.vertical());
            initChildren(new Label(label),
                new Group(AxisLayout.horizontal()).add(new Label("N:"), nx, ny),
                new Group(AxisLayout.horizontal()).add(new Label("O:"), ox, oy));
            UnitSlot update = new UnitSlot() {
                @Override public void onEmit () {
                    point.update(new BoxPoint(
                        nx.value.get(), ny.value.get(), ox.value.get(), oy.value.get()));
                }
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)),
View Full Code Here

        addUI(this, root, 0);
        return root;
    }

    protected void addUI (final Screen screen, Elements<?> root, final int depth) {
        root.add(new Label("Screen " + depth));

        root.add(new Button("Slide").onClick(new UnitSlot() { public void onEmit () {
            _stack.push(createScreen(depth+1), _stack.slide());
        }}));
        root.add(new Button("Turn").onClick(new UnitSlot() { public void onEmit () {
View Full Code Here

        _root = iface.createRoot(AxisLayout.vertical().gap(15), SimpleStyles.newSheet(), layer);
        _root.addStyles(Style.BACKGROUND.is(Background.bordered(0xFFCCCCCC, 0xFF99CCFF, 5).
                                            inset(5, 10)));
        _root.setSize(width(), height());

        _root.add(new Label("Triple Play Demos").addStyles(Style.FONT.is(DemoScreen.TITLE_FONT)));

        Group grid = new Group(new TableLayout(
                                   TableLayout.COL.alignRight(),
                                   TableLayout.COL.stretch(),
                                   TableLayout.COL.stretch(),
                                   TableLayout.COL.stretch()).gaps(10, 10));
        _root.add(grid);

        int shown = 0, toShow = (TripleDemo.mainArgs.length == 0) ? -1 :
            Integer.parseInt(TripleDemo.mainArgs[0]);

        for (int ii = 0; ii < _screens.length; ii++) {
            if (ii%3 == 0) grid.add(new Label(_rlabels[ii/3]));
            final DemoScreen screen = _screens[ii];
            if (screen == null) {
                grid.add(new Shim(1, 1));
            } else {
                grid.add(new Button(screen.name()).onClick(new UnitSlot() { public void onEmit () {
View Full Code Here

TOP

Related Classes of tripleplay.ui.Label

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.