Package tripleplay.ui

Examples of tripleplay.ui.Button


        Group buttons = new Group(
            AxisLayout.horizontal(),
            Styles.make(Style.BACKGROUND.is(Background.solid(0xFFFFFFFF).inset(5))));

        for (final String edge : Panel.EDGES) {
            buttons.add(new Button(edge).onClick(new UnitSlot() {
                @Override public void onEmit () {
                    _panel.toggleEdge(edge);
                }
            }));
        }

        buttons.add(new Shim(10, 1)).add(new Button("Toggle Gaps").onClick(new UnitSlot() {
            @Override public void onEmit () {
                setPanel(_panel.useGroups, _panel.gaps == 0 ? 5 : 0);
            }
        }));

        buttons.add(new Shim(10, 1)).add(new Button("Toggle Sizing").onClick(new UnitSlot() {
            @Override public void onEmit () {
                setPanel(!_panel.useGroups, _panel.gaps);
            }
        }));
View Full Code Here


            return e;
        }
    }

    protected static Button getSizer (SizableGroup g, String text, float dw, float dh) {
        return new Button(text).onClick(getSizer(g.preferredSize, dw, dh));
    }
View Full Code Here

    @Override protected Group createIface () {
        final int [] lastTab = {0};
        final Tabs tabs = new Tabs().addStyles(Style.BACKGROUND.is(
            Background.bordered(Colors.WHITE, Colors.BLACK, 1).inset(1)));
        final Button moveRight = new Button("Move Right").onClick(new UnitSlot() {
            @Override public void onEmit () {
                Tabs.Tab tab = tabs.selected.get();
                if (movable(tab)) {
                    tabs.repositionTab(tab, tab.index() + 1);
                }
            }
        }).setEnabled(false);
        final Button hide = new Button("Hide").onClick(new UnitSlot() {
            @Override public void onEmit () {
                Tabs.Tab tab = tabs.selected.get();
                if (tab != null) {
                    tab.setVisible(false);
                }
            }
        }).setEnabled(false);
        tabs.selected.connect(new Slot<Tabs.Tab>() {
            @Override public void onEmit (Tabs.Tab tab) {
                moveRight.setEnabled(movable(tab));
                hide.setEnabled(tab != null);
            }
        });
        return new Group(AxisLayout.vertical().offStretch()).add(
            new Group(AxisLayout.horizontal()).add(
                new Button("Add").onClick(new UnitSlot() {
                    @Override public void onEmit () {
                        String label = _prefix + ++lastTab[0];
                        tabs.add(label, tabContent(label));
                    }
                }),
                new Button("Remove...").onClick(new TabSelector(tabs) {
                    @Override public void handle (Tabs.Tab tab) {
                        tabs.destroyTab(tab);
                    }
                }),
                new Button("Highlight...").onClick(new TabSelector(tabs) {
                    @Override public void handle (Tabs.Tab tab) {
                        tabs.highlighter().highlight(tab, true);
                    }
                }), moveRight, hide, new Button("Show All").onClick(new UnitSlot() {
                    @Override public void onEmit () {
                        for (int ii = 0; ii < tabs.tabCount(); ii++) {
                            tabs.tabAt(ii).setVisible(true);
                        }
                    }
View Full Code Here

                new Group(new TableLayout(COL, COL).gaps(5, 5), greenBg).add(
                    new Label("Upper left"), new Label("Upper right"),
                    new Label("Lower left"), new Label("Lower right")),

                new Group(alignDemo, greenBg).add(
                    new Button("Foo"),
                    new Button("Bar"),
                    new Button("Baz"),
                    new Button("Foozle"),
                    new Button("Barzle"),
                    new Button("Bazzle")),

                new Group(fixedDemo, greenBg).add(
                    new Button("Fixed"),
                    new Button("Free"),
                    new Button("Stretch+free"),
                    new Button("Fixed"),
                    new Button("Free"),
                    new Button("Stretch+free")),

                new Group(minWidthDemo, greenBg).add(
                    new Button("Min"),
                    new Button("M+stretch"),
                    new Button("Free"),
                    new Button("Min"),
                    new Button("M+stretch"),
                    new Button("Free"))),

            new Shim(15, 15),
            new Label("Absolute Layout"),
            new Group(new AbsoluteLayout(), greyBg).add(
                AbsoluteLayout.at(new Label("+50+20"), 50, 20),
                AbsoluteLayout.at(new Button("150x35+150+50"), 150, 50, 150, 35)));

        return iface;
    }
View Full Code Here

        _root = iface.createRoot(AxisLayout.vertical().gap(0).offStretch(), stylesheet(), layer);
        _root.addStyles(Style.BACKGROUND.is(background()), Style.VALIGN.top);
        _root.setSize(width(), height());
        Background bg = Background.solid(0xFFCC99FF).inset(0, 0, 5, 0);
        _root.add(new Group(AxisLayout.horizontal(), Style.HALIGN.left, Style.BACKGROUND.is(bg)).add(
                      this.back = new Button("Back"),
                      new Label(title()).addStyles(Style.FONT.is(TITLE_FONT), Style.HALIGN.center).
                      setConstraint(AxisLayout.stretched())));
        if (subtitle() != null) _root.add(new Label(subtitle()));
        Group iface = createIface();
        if (iface != null) _root.add(iface.setConstraint(AxisLayout.stretched()));
View Full Code Here

            }
        };
        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

        final Group panel = new Group(new FlowLayout(), Styles.make(Style.BACKGROUND.is(
            Background.bordered(0xFFFFFFFF, 0xff000000, 2).inset(4))));

        Group buttons = new Group(AxisLayout.horizontal());
        for (final ElemType type : ElemType.values()) {
            buttons.add(new Button("Add " + type.toString()).onClick(new UnitSlot() {
                @Override public void onEmit () { panel.add(create(type)); }
            }));
        }
        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)); }
            }));
        }
        root.add(buttons);
View Full Code Here

    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 () {
        final Field prefix = new Field("Love Potion Number ");
        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);
            }
        });
        add10.clicked().connect(addSome(history, prefix, 10));
        add100.clicked().connect(addSome(history, prefix, 100));
        history.setStylesheet(Stylesheet.builder().add(Label.class,
            Style.BACKGROUND.is(Background.composite(
                Background.blank().inset(0, 2),
                Background.bordered(Colors.WHITE, Colors.BLACK, 1).inset(10))),
            Style.TEXT_WRAP.on, Style.HALIGN.left).create());
View Full Code Here

    }

    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 () {
            _stack.push(createScreen(depth+1), _stack.pageTurn());
        }}));
        root.add(new Button("Flip").onClick(new UnitSlot() { public void onEmit () {
            _stack.push(createScreen(depth+1), _stack.flip());
        }}));

        if (depth > 0) {
            root.add(new Button("Replace").onClick(new UnitSlot() { public void onEmit () {
                _stack.replace(createScreen(depth+1), _stack.slide().left());
            }}));
            root.add(new Button("Back").onClick(new UnitSlot() { public void onEmit () {
                _stack.remove(screen, _stack.flip().unflip());
            }}));
            root.add(new Button("Top").onClick(new UnitSlot() { public void onEmit () {
                _stack.popTo(ScreensDemo.this, _stack.slide().right());
            }}));
        }
    }
View Full Code Here

TOP

Related Classes of tripleplay.ui.Button

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.