Search in sources :

Example 1 with ImageTextButton

use of com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton in project skin-composer by raeleus.

the class RootTable method refreshPreview.

public void refreshPreview() {
    if (previewTable != null) {
        previewTable.clear();
        previewTable.setBackground("white");
        previewTable.setColor((Color) previewProperties.get("bgcolor"));
        for (BitmapFont font : previewFonts) {
            font.dispose();
        }
        if (classSelectBox.getSelectedIndex() >= 0 && classSelectBox.getSelectedIndex() < Main.BASIC_CLASSES.length) {
            StyleData styleData = getSelectedStyle();
            Class clazz = Main.BASIC_CLASSES[classSelectBox.getSelectedIndex()];
            if (!styleData.hasMandatoryFields()) {
                Label label;
                if (clazz.equals(SelectBox.class)) {
                    label = new Label("Please fill all mandatory fields\n(Highlighted on the left)\n\nscrollStyle and listStyle\nmust already be defined", getSkin());
                } else if (clazz.equals(TextTooltip.class)) {
                    label = new Label("Please fill all mandatory fields\n(Highlighted on the left)\n\nlabel must already be defined", getSkin());
                } else {
                    label = new Label("Please fill all mandatory fields\n(Highlighted on the left)", getSkin());
                }
                label.setAlignment(Align.center);
                previewTable.add(label);
            } else if (styleData.hasAllNullFields()) {
                Label label;
                label = new Label("All fields are empty!\nEmpty classes are not exported\nAdd style properties in the menu to the left", getSkin());
                label.setAlignment(Align.center);
                previewTable.add(label);
            } else {
                Actor widget = null;
                if (clazz.equals(Button.class)) {
                    Button.ButtonStyle style = createPreviewStyle(Button.ButtonStyle.class, styleData);
                    widget = new Button(style);
                    ((Button) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(CheckBox.class)) {
                    CheckBox.CheckBoxStyle style = createPreviewStyle(CheckBox.CheckBoxStyle.class, styleData);
                    widget = new CheckBox("", style);
                    ((CheckBox) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    ((CheckBox) widget).setText((String) previewProperties.get("text"));
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(ImageButton.class)) {
                    ImageButtonStyle style = createPreviewStyle(ImageButtonStyle.class, styleData);
                    widget = new ImageButton(style);
                    ((ImageButton) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(ImageTextButton.class)) {
                    ImageTextButton.ImageTextButtonStyle style = createPreviewStyle(ImageTextButton.ImageTextButtonStyle.class, styleData);
                    widget = new ImageTextButton("", style);
                    ((ImageTextButton) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    ((ImageTextButton) widget).setText((String) previewProperties.get("text"));
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(Label.class)) {
                    LabelStyle style = createPreviewStyle(LabelStyle.class, styleData);
                    widget = new Label("", style);
                    ((Label) widget).setText((String) previewProperties.get("text"));
                } else if (clazz.equals(List.class)) {
                    ListStyle style = createPreviewStyle(ListStyle.class, styleData);
                    widget = new List(style);
                    Array<String> items = new Array<>(((String) previewProperties.get("text")).split("\\n"));
                    ((List) widget).setItems(items);
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(ProgressBar.class)) {
                    ProgressBar.ProgressBarStyle style = createPreviewStyle(ProgressBar.ProgressBarStyle.class, styleData);
                    widget = new ProgressBar((float) (double) previewProperties.get("minimum"), (float) (double) previewProperties.get("maximum"), (float) (double) previewProperties.get("increment"), (boolean) previewProperties.get("orientation"), style);
                    ((ProgressBar) widget).setValue((float) (double) previewProperties.get("value"));
                    ((ProgressBar) widget).setDisabled((boolean) previewProperties.get("disabled"));
                } else if (clazz.equals(ScrollPane.class)) {
                    ScrollPaneStyle style = createPreviewStyle(ScrollPaneStyle.class, styleData);
                    Label label = new Label("", getSkin());
                    widget = new ScrollPane(label, style);
                    ((ScrollPane) widget).setScrollbarsOnTop((boolean) previewProperties.get("scrollbarsOnTop"));
                    ((ScrollPane) widget).setScrollBarPositions((boolean) previewProperties.get("hScrollBarPosition"), (boolean) previewProperties.get("vScrollBarPosition"));
                    ((ScrollPane) widget).setScrollingDisabled((boolean) previewProperties.get("hScrollDisabled"), (boolean) previewProperties.get("vScrollDisabled"));
                    ((ScrollPane) widget).setForceScroll((boolean) previewProperties.get("forceHscroll"), (boolean) previewProperties.get("forceVscroll"));
                    ((ScrollPane) widget).setVariableSizeKnobs((boolean) previewProperties.get("variableSizeKnobs"));
                    ((ScrollPane) widget).setOverscroll((boolean) previewProperties.get("hOverscroll"), (boolean) previewProperties.get("vOverscroll"));
                    ((ScrollPane) widget).setFadeScrollBars((boolean) previewProperties.get("fadeScroll"));
                    ((ScrollPane) widget).setSmoothScrolling((boolean) previewProperties.get("smoothScroll"));
                    ((ScrollPane) widget).setFlickScroll((boolean) previewProperties.get("flickScroll"));
                    ((ScrollPane) widget).setClamp((boolean) previewProperties.get("clamp"));
                    label.setText((String) previewProperties.get("text"));
                } else if (clazz.equals(SelectBox.class)) {
                    SelectBox.SelectBoxStyle style = createPreviewStyle(SelectBox.SelectBoxStyle.class, styleData);
                    widget = new SelectBox(style);
                    ((SelectBox) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    Array<String> items = new Array<>(((String) previewProperties.get("text")).split("\\n"));
                    ((SelectBox) widget).setItems(items);
                    widget.addListener(main.getHandListener());
                    ((SelectBox) widget).getList().addListener(main.getHandListener());
                } else if (clazz.equals(Slider.class)) {
                    Slider.SliderStyle style = createPreviewStyle(Slider.SliderStyle.class, styleData);
                    widget = new Slider((float) (double) previewProperties.get("minimum"), (float) (double) previewProperties.get("maximum"), (float) (double) previewProperties.get("increment"), (boolean) previewProperties.get("orientation"), style);
                    ((Slider) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(SplitPane.class)) {
                    SplitPane.SplitPaneStyle style = createPreviewStyle(SplitPane.SplitPaneStyle.class, styleData);
                    Label label1 = new Label("", getSkin());
                    Label label2 = new Label("", getSkin());
                    widget = new SplitPane(label1, label2, (boolean) previewProperties.get("orientation"), style);
                    label1.setText((String) previewProperties.get("text"));
                    label2.setText((String) previewProperties.get("text"));
                    if ((boolean) previewProperties.get("orientation")) {
                        widget.addListener(vSplitPaneDragListener);
                        widget.addListener(vSplitPaneInputListener);
                    } else {
                        widget.addListener(hSplitPaneDragListener);
                        widget.addListener(hSplitPaneInputListener);
                    }
                } else if (clazz.equals(TextButton.class)) {
                    TextButtonStyle style = createPreviewStyle(TextButtonStyle.class, styleData);
                    widget = new TextButton("", style);
                    ((TextButton) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    ((TextButton) widget).setText((String) previewProperties.get("text"));
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(TextField.class)) {
                    TextFieldStyle style = createPreviewStyle(TextFieldStyle.class, styleData);
                    widget = new TextField("", style);
                    ((TextField) widget).setFocusTraversal(false);
                    ((TextField) widget).setDisabled((boolean) previewProperties.get("disabled"));
                    ((TextField) widget).setPasswordMode((boolean) previewProperties.get("passwordMode"));
                    ((TextField) widget).setAlignment((int) previewProperties.get("alignment"));
                    ((TextField) widget).setText((String) previewProperties.get("text"));
                    ((TextField) widget).setMessageText((String) previewProperties.get("message"));
                    String string = (String) previewProperties.get("password");
                    if (string.length() > 0) {
                        ((TextField) widget).setPasswordCharacter(string.charAt(0));
                    }
                    widget.addListener(main.getIbeamListener());
                } else if (clazz.equals(TextTooltip.class)) {
                    TextTooltip.TextTooltipStyle style = createPreviewStyle(TextTooltip.TextTooltipStyle.class, styleData);
                    TooltipManager manager = new TooltipManager();
                    manager.animations = false;
                    manager.initialTime = 0.0f;
                    manager.resetTime = 0.0f;
                    manager.subsequentTime = 0.0f;
                    manager.hideAll();
                    manager.instant();
                    TextTooltip toolTip = new TextTooltip((String) previewProperties.get("text"), manager, style);
                    widget = new Label("Hover over me", getSkin());
                    widget.addListener(toolTip);
                } else if (clazz.equals(Touchpad.class)) {
                    Touchpad.TouchpadStyle style = createPreviewStyle(Touchpad.TouchpadStyle.class, styleData);
                    widget = new Touchpad(0, style);
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(Tree.class)) {
                    Tree.TreeStyle style = createPreviewStyle(Tree.TreeStyle.class, styleData);
                    widget = new Tree(style);
                    String[] lines = { "this", "is", "a", "test" };
                    Tree.Node parentNode = null;
                    for (String line : lines) {
                        Label label = new Label(line, getSkin());
                        Tree.Node node = new Tree.Node(label);
                        if (parentNode == null) {
                            ((Tree) widget).add(node);
                        } else {
                            parentNode.add(node);
                        }
                        parentNode = node;
                    }
                    widget.addListener(main.getHandListener());
                } else if (clazz.equals(Window.class)) {
                    Window.WindowStyle style = createPreviewStyle(Window.WindowStyle.class, styleData);
                    if (style.stageBackground != null) {
                        previewTable.setBackground(style.stageBackground);
                        previewTable.setColor(Color.WHITE);
                        style.stageBackground = null;
                    }
                    Label sampleText = new Label("", getSkin());
                    sampleText.setText((String) previewProperties.get("text"));
                    widget = new Window((String) previewProperties.get("title"), style);
                    ((Window) widget).add(sampleText);
                }
                if (widget != null) {
                    switch((int) previewProperties.get("size")) {
                        case (0):
                            previewTable.add(widget).size(10.0f);
                            previewSizeSelectBox.setItems(DEFAULT_SIZES);
                            break;
                        case (1):
                            previewTable.add(widget);
                            previewSizeSelectBox.setItems(DEFAULT_SIZES);
                            break;
                        case (2):
                            previewTable.add(widget).size(200.0f);
                            previewSizeSelectBox.setItems(DEFAULT_SIZES);
                            break;
                        case (3):
                            previewTable.add(widget).growX();
                            previewSizeSelectBox.setItems(DEFAULT_SIZES);
                            break;
                        case (4):
                            previewTable.add(widget).growY();
                            previewSizeSelectBox.setItems(DEFAULT_SIZES);
                            break;
                        case (5):
                            previewTable.add(widget).grow();
                            previewSizeSelectBox.setItems(DEFAULT_SIZES);
                            break;
                        case (6):
                            Actor addWidget = widget;
                            TraversalTextField widthField = new TraversalTextField("", getSkin());
                            TraversalTextField heightField = new TraversalTextField("", getSkin());
                            widthField.setNextFocus(heightField);
                            heightField.setNextFocus(widthField);
                            Dialog dialog = new Dialog("Enter dimensions...", getSkin()) {

                                @Override
                                protected void result(Object object) {
                                    if ((boolean) object) {
                                        previewTable.add(addWidget).size(Integer.parseInt(widthField.getText()), Integer.parseInt(heightField.getText()));
                                        Array<String> items = new Array<>(DEFAULT_SIZES);
                                        items.add(widthField.getText() + "x" + heightField.getText());
                                        previewProperties.put("sizeX", Integer.parseInt(widthField.getText()));
                                        previewProperties.put("sizeY", Integer.parseInt(heightField.getText()));
                                        previewSizeSelectBox.setItems(items);
                                        previewSizeSelectBox.setSelectedIndex(7);
                                    } else {
                                        previewSizeSelectBox.setSelectedIndex(1);
                                    }
                                }
                            };
                            dialog.getTitleTable().getCells().first().padLeft(5.0f);
                            dialog.text("Enter the preview dimensions: ");
                            dialog.getContentTable().getCells().first().pad(10.0f);
                            dialog.getContentTable().row();
                            Table sizeTable = new Table();
                            sizeTable.add(widthField).padLeft(10.0f);
                            sizeTable.add(new Label(" x ", getSkin()));
                            sizeTable.add(heightField).padRight(10.0f);
                            dialog.getContentTable().add(sizeTable);
                            dialog.getButtonTable().defaults().padBottom(10.0f).minWidth(50.0f);
                            dialog.button("OK", true);
                            dialog.button("Cancel", false);
                            TextButton okButton = (TextButton) dialog.getButtonTable().getCells().first().getActor();
                            okButton.setDisabled(true);
                            okButton.addListener(main.getHandListener());
                            widthField.addListener(new ChangeListener() {

                                @Override
                                public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                                    okButton.setDisabled(!widthField.getText().matches("^\\d+$") || !heightField.getText().matches("^\\d+$"));
                                }
                            });
                            heightField.addListener(new ChangeListener() {

                                @Override
                                public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                                    okButton.setDisabled(!widthField.getText().matches("^\\d+$") || !heightField.getText().matches("^\\d+$"));
                                }
                            });
                            dialog.getButtonTable().getCells().get(1).getActor().addListener(main.getHandListener());
                            dialog.key(Input.Keys.ESCAPE, false);
                            dialog.show(stage);
                            stage.setKeyboardFocus(widthField);
                            break;
                        case (7):
                            previewTable.add(widget).size((int) previewProperties.get("sizeX"), (int) previewProperties.get("sizeY"));
                            break;
                    }
                }
            }
        } else {
            CustomStyle customStyle = (CustomStyle) styleSelectBox.getSelected();
            boolean showMessage = true;
            if (customStyle.getProperties().size == 0) {
                Label label = new Label("No style properties!\nEmpty classes are not exported\nAdd style properties in the menu to the left", getSkin());
                label.setAlignment(0);
                previewTable.add(label);
            } else {
                for (CustomProperty customProperty : customStyle.getProperties()) {
                    if (customProperty.getValue() != null && !(customProperty.getValue() instanceof String) || customProperty.getValue() != null && !((String) customProperty.getValue()).equals("")) {
                        showMessage = false;
                        break;
                    }
                }
                if (showMessage) {
                    Label label = new Label("All properties are empty!\nEmpty classes are not exported\nAdd style properties in the menu to the left", getSkin());
                    label.setAlignment(0);
                    previewTable.add(label);
                }
            }
            if (!showMessage) {
                HorizontalGroup horizontalGroup = new HorizontalGroup();
                horizontalGroup.wrap();
                // the following causes a crash. LibGDX bug.
                // horizontalGroup.space(10.0f);
                horizontalGroup.wrapSpace(10.0f);
                horizontalGroup.setTouchable(Touchable.disabled);
                previewTable.add(horizontalGroup).grow().pad(10.0f);
                for (CustomProperty customProperty : customStyle.getProperties()) {
                    if (customProperty.getValue() != null) {
                        Container container = new Container();
                        container.pad(5.0f);
                        horizontalGroup.addActor(container);
                        switch(customProperty.getType()) {
                            case TEXT:
                            case RAW_TEXT:
                                Label labelText = new Label((String) customProperty.getValue(), getSkin());
                                container.setActor(labelText);
                                break;
                            case NUMBER:
                                Label labelNumber = new Label(Double.toString((double) customProperty.getValue()), getSkin());
                                container.setActor(labelNumber);
                                break;
                            case BOOL:
                                Label labelBoolean = new Label(Boolean.toString((boolean) customProperty.getValue()), getSkin());
                                container.setActor(labelBoolean);
                                break;
                            case COLOR:
                                ColorData colorData = null;
                                String colorName = (String) customProperty.getValue();
                                for (ColorData cd : main.getJsonData().getColors()) {
                                    if (cd.getName().equals(colorName)) {
                                        colorData = cd;
                                        break;
                                    }
                                }
                                if (colorData != null) {
                                    Table colorTable = new Table(getSkin());
                                    colorTable.setBackground("white");
                                    colorTable.setColor(colorData.color);
                                    colorTable.add().size(25.0f);
                                    container.setActor(colorTable);
                                }
                                break;
                            case FONT:
                                BitmapFont font = null;
                                FontData fontData = null;
                                String fontName = (String) customProperty.getValue();
                                for (FontData fd : main.getJsonData().getFonts()) {
                                    if (fd.getName().equals(fontName)) {
                                        fontData = fd;
                                        font = new BitmapFont(fd.file);
                                        previewFonts.add(font);
                                        break;
                                    }
                                }
                                if (font != null) {
                                    Label labelFont = new Label(fontData.getName(), new LabelStyle(font, Color.WHITE));
                                    container.setActor(labelFont);
                                }
                                FreeTypeFontData freeTypeFontData = null;
                                for (FreeTypeFontData fd : main.getJsonData().getFreeTypeFonts()) {
                                    if (fd.name.equals(fontName)) {
                                        freeTypeFontData = fd;
                                        break;
                                    }
                                }
                                if (freeTypeFontData.bitmapFont != null) {
                                    Label labelFont = new Label(freeTypeFontData.name, new LabelStyle(freeTypeFontData.bitmapFont, Color.WHITE));
                                    container.setActor(labelFont);
                                }
                                break;
                            case DRAWABLE:
                                DrawableData drawable = null;
                                String drawableName = (String) customProperty.getValue();
                                for (DrawableData dd : main.getAtlasData().getDrawables()) {
                                    if (dd.name.equals(drawableName)) {
                                        drawable = dd;
                                        break;
                                    }
                                }
                                if (drawable != null) {
                                    Image image = new Image(drawablePairs.get(drawable.name));
                                    container.setActor(image);
                                }
                                break;
                        }
                    }
                }
            }
        }
    }
}
Also used : Label(com.badlogic.gdx.scenes.scene2d.ui.Label) SplitPane(com.badlogic.gdx.scenes.scene2d.ui.SplitPane) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) Container(com.badlogic.gdx.scenes.scene2d.ui.Container) DrawableData(com.ray3k.skincomposer.data.DrawableData) TextTooltip(com.badlogic.gdx.scenes.scene2d.ui.TextTooltip) Button(com.badlogic.gdx.scenes.scene2d.ui.Button) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) Touchpad(com.badlogic.gdx.scenes.scene2d.ui.Touchpad) Dialog(com.badlogic.gdx.scenes.scene2d.ui.Dialog) Actor(com.badlogic.gdx.scenes.scene2d.Actor) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) Tree(com.badlogic.gdx.scenes.scene2d.ui.Tree) List(com.badlogic.gdx.scenes.scene2d.ui.List) HorizontalGroup(com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup) ImageButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle) TextButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) FreeTypeFontData(com.ray3k.skincomposer.data.FreeTypeFontData) FontData(com.ray3k.skincomposer.data.FontData) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) TooltipManager(com.badlogic.gdx.scenes.scene2d.ui.TooltipManager) ScrollPaneStyle(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane.ScrollPaneStyle) ListStyle(com.badlogic.gdx.scenes.scene2d.ui.List.ListStyle) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) ImageButton(com.badlogic.gdx.scenes.scene2d.ui.ImageButton) TextButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle) ImageButtonStyle(com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont) ProgressBar(com.badlogic.gdx.scenes.scene2d.ui.ProgressBar) StyleData(com.ray3k.skincomposer.data.StyleData) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Window(com.badlogic.gdx.scenes.scene2d.ui.Window) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) LabelStyle(com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle) TextFieldStyle(com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle) CustomStyle(com.ray3k.skincomposer.data.CustomStyle) Array(com.badlogic.gdx.utils.Array) ColorData(com.ray3k.skincomposer.data.ColorData) FreeTypeFontData(com.ray3k.skincomposer.data.FreeTypeFontData) CustomProperty(com.ray3k.skincomposer.data.CustomProperty)

Example 2 with ImageTextButton

use of com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton in project skin-composer by raeleus.

the class RootTable method refreshPreviewProperties.

public void refreshPreviewProperties() {
    if (previewPropertiesTable != null) {
        previewPropertiesTable.clear();
        previewProperties.clear();
        Table t = new Table();
        previewPropertiesTable.add(t).grow();
        t.defaults().pad(3.0f);
        if (previewBgColor == null) {
            previewBgColor.set(Color.WHITE);
        }
        previewProperties.put("bgcolor", previewBgColor);
        if (classSelectBox.getSelectedIndex() >= 0 && classSelectBox.getSelectedIndex() < Main.BASIC_CLASSES.length) {
            t.add(new Label("Stage Color: ", getSkin())).right();
            BrowseField browseField = new BrowseField(null, null, getSkin(), "color");
            browseField.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                    main.getDialogFactory().showDialogColorPicker((Color) previewProperties.get("bgcolor"), new DialogColorPicker.ColorListener() {

                        @Override
                        public void selected(Color color) {
                            if (color != null) {
                                browseField.getTextButton().setText((int) (color.r * 255) + "," + (int) (color.g * 255) + "," + (int) (color.b * 255) + "," + (int) (color.a * 255));
                                previewProperties.put("bgcolor", color);
                                previewBgColor.set(color);
                                refreshPreview();
                            }
                        }
                    });
                }
            });
            browseField.addListener(main.getHandListener());
            t.add(browseField).growX();
            browseField.getTextButton().setText((int) (previewBgColor.r * 255) + "," + (int) (previewBgColor.g * 255) + "," + (int) (previewBgColor.b * 255) + "," + (int) (previewBgColor.a * 255));
            t.row();
            t.add(new Label("Size: ", getSkin())).right();
            previewSizeSelectBox = new SelectBox<>(getSkin());
            previewSizeSelectBox.setItems(DEFAULT_SIZES);
            previewSizeSelectBox.setSelectedIndex(1);
            previewSizeSelectBox.addListener(main.getHandListener());
            previewSizeSelectBox.getList().addListener(main.getHandListener());
            t.add(previewSizeSelectBox).growX().minWidth(200.0f);
            Class clazz = Main.BASIC_CLASSES[classSelectBox.getSelectedIndex()];
            if (clazz.equals(Button.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                disabledCheckBox.addListener(main.getHandListener());
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                t.add(disabledCheckBox).left();
            } else if (clazz.equals(CheckBox.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                disabledCheckBox.addListener(main.getHandListener());
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                t.add(disabledCheckBox).left();
                t.row();
                t.add(new Label("Text: ", getSkin())).right();
                TextField previewTextField = new TextField(TEXT_SAMPLE, getSkin());
                previewTextField.setFocusTraversal(false);
                previewTextField.addListener(main.getIbeamListener());
                previewTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", previewTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", previewTextField.getText());
                t.add(previewTextField).growX();
            } else if (clazz.equals(ImageButton.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                disabledCheckBox.addListener(main.getHandListener());
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                t.add(disabledCheckBox).left();
            } else if (clazz.equals(ImageTextButton.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                disabledCheckBox.addListener(main.getHandListener());
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                t.add(disabledCheckBox).left();
                t.row();
                t.add(new Label("Text: ", getSkin())).right();
                TextField previewTextField = new TextField(TEXT_SAMPLE, getSkin());
                previewTextField.setFocusTraversal(false);
                previewTextField.addListener(main.getIbeamListener());
                previewTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", previewTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", previewTextField.getText());
                t.add(previewTextField).growX();
            } else if (clazz.equals(Label.class)) {
                t.row();
                t.add(new Label("Text: ", getSkin())).right();
                TextField previewTextField = new TextField(TEXT_SAMPLE, getSkin());
                previewTextField.setFocusTraversal(false);
                previewTextField.addListener(main.getIbeamListener());
                previewTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", previewTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", previewTextField.getText());
                t.add(previewTextField).growX();
            } else if (clazz.equals(List.class)) {
                t.row();
                t.add(new Label("List Items: ", getSkin())).right();
                TextArea listItemsTextArea = new TextArea("Lorem ipsum\ndolor sit\namet, consectetur", getSkin());
                listItemsTextArea.setFocusTraversal(false);
                listItemsTextArea.setPrefRows(3);
                listItemsTextArea.addListener(main.getIbeamListener());
                listItemsTextArea.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", listItemsTextArea.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", listItemsTextArea.getText());
                t.add(listItemsTextArea).growX();
            } else if (clazz.equals(ProgressBar.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                disabledCheckBox.addListener(main.getHandListener());
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                t.add(disabledCheckBox).left();
                t.row();
                t.add(new Label("Value: ", getSkin())).right();
                Spinner valueSpinner = new Spinner(0.0f, 1.0f, false, Spinner.Orientation.HORIZONTAL, getSkin());
                valueSpinner.getTextField().setFocusTraversal(false);
                valueSpinner.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("value", valueSpinner.getValue());
                        refreshPreview();
                    }
                });
                valueSpinner.getButtonMinus().addListener(main.getHandListener());
                valueSpinner.getButtonPlus().addListener(main.getHandListener());
                valueSpinner.getTextField().addListener(main.getIbeamListener());
                previewProperties.put("value", valueSpinner.getValue());
                t.add(valueSpinner).growX();
                t.row();
                t.add(new Label("Minimum: ", getSkin())).right();
                Spinner minimumSpinner = new Spinner(0.0f, 1.0f, false, Spinner.Orientation.HORIZONTAL, getSkin());
                minimumSpinner.getTextField().setFocusTraversal(false);
                minimumSpinner.getTextField().addListener(main.getIbeamListener());
                minimumSpinner.getButtonMinus().addListener(main.getHandListener());
                minimumSpinner.getButtonPlus().addListener(main.getHandListener());
                previewProperties.put("minimum", minimumSpinner.getValue());
                t.add(minimumSpinner).growX();
                t.row();
                t.add(new Label("Maximum: ", getSkin())).right();
                Spinner maximumSpinner = new Spinner(100.0f, 1.0f, false, Spinner.Orientation.HORIZONTAL, getSkin());
                maximumSpinner.getTextField().setFocusTraversal(false);
                maximumSpinner.getTextField().addListener(main.getIbeamListener());
                maximumSpinner.getButtonMinus().addListener(main.getHandListener());
                maximumSpinner.getButtonPlus().addListener(main.getHandListener());
                previewProperties.put("maximum", maximumSpinner.getValue());
                t.add(maximumSpinner).growX();
                minimumSpinner.setMaximum(maximumSpinner.getValue());
                maximumSpinner.setMinimum(minimumSpinner.getValue());
                minimumSpinner.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("minimum", minimumSpinner.getValue());
                        maximumSpinner.setMinimum(minimumSpinner.getValue());
                        refreshPreview();
                    }
                });
                maximumSpinner.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("maximum", maximumSpinner.getValue());
                        minimumSpinner.setMaximum(maximumSpinner.getValue());
                        refreshPreview();
                    }
                });
                t.row();
                t.add(new Label("Increment: ", getSkin())).right();
                Spinner incrementSpinner = new Spinner(1.0f, 1.0f, false, Spinner.Orientation.HORIZONTAL, getSkin());
                incrementSpinner.getTextField().setFocusTraversal(false);
                incrementSpinner.setMinimum(1);
                incrementSpinner.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("increment", incrementSpinner.getValue());
                        refreshPreview();
                    }
                });
                incrementSpinner.getTextField().addListener(main.getIbeamListener());
                incrementSpinner.getButtonMinus().addListener(main.getHandListener());
                incrementSpinner.getButtonPlus().addListener(main.getHandListener());
                previewProperties.put("increment", incrementSpinner.getValue());
                t.add(incrementSpinner).growX();
                t.row();
                t.add(new Label("Orientation: ", getSkin())).right();
                SelectBox<String> selectBox = new SelectBox<>(getSkin());
                selectBox.setItems(new String[] { "Horizontal", "Vertical" });
                if (getSelectedStyle().name.contains("vert")) {
                    previewProperties.put("orientation", true);
                    selectBox.setSelectedIndex(1);
                } else {
                    previewProperties.put("orientation", false);
                }
                selectBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        if (selectBox.getSelectedIndex() == 0) {
                            previewProperties.put("orientation", false);
                        } else {
                            previewProperties.put("orientation", true);
                        }
                        refreshPreview();
                    }
                });
                selectBox.addListener(main.getHandListener());
                selectBox.getList().addListener(main.getHandListener());
                t.add(selectBox).growX();
            } else if (clazz.equals(ScrollPane.class)) {
                t.row();
                t.add(new Label("Scrollbars On Top: ", getSkin())).right();
                ImageTextButton onTopCheckBox = new ImageTextButton("", getSkin(), "switch");
                onTopCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("scrollbarsOnTop", onTopCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(onTopCheckBox).left();
                onTopCheckBox.addListener(main.getHandListener());
                previewProperties.put("scrollbarsOnTop", onTopCheckBox.isChecked());
                t.row();
                t.add(new Label("H ScrollBar Position: ", getSkin())).right();
                SelectBox<String> hScrollPosBox = new SelectBox<>(getSkin());
                hScrollPosBox.setItems(new String[] { "Top", "Bottom" });
                hScrollPosBox.setSelectedIndex(1);
                hScrollPosBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        if (hScrollPosBox.getSelectedIndex() == 0) {
                            previewProperties.put("hScrollBarPosition", false);
                        } else {
                            previewProperties.put("hScrollBarPosition", true);
                        }
                        refreshPreview();
                    }
                });
                t.add(hScrollPosBox).growX();
                hScrollPosBox.addListener(main.getHandListener());
                hScrollPosBox.getList().addListener(main.getHandListener());
                previewProperties.put("hScrollBarPosition", true);
                t.row();
                t.add(new Label("V ScrollBar Position: ", getSkin())).right();
                SelectBox<String> vScrollPosBox = new SelectBox<>(getSkin());
                vScrollPosBox.setItems(new String[] { "Left", "Right" });
                vScrollPosBox.setSelectedIndex(1);
                vScrollPosBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        if (vScrollPosBox.getSelectedIndex() == 0) {
                            previewProperties.put("vScrollBarPosition", false);
                        } else {
                            previewProperties.put("vScrollBarPosition", true);
                        }
                        refreshPreview();
                    }
                });
                t.add(vScrollPosBox).growX();
                vScrollPosBox.addListener(main.getHandListener());
                vScrollPosBox.getList().addListener(main.getHandListener());
                previewProperties.put("vScrollBarPosition", true);
                t.row();
                t.add(new Label("H Scrolling Disabled: ", getSkin())).right();
                ImageTextButton hScrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                hScrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("hScrollDisabled", hScrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(hScrollCheckBox).left();
                hScrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("hScrollDisabled", hScrollCheckBox.isChecked());
                t.row();
                t.add(new Label("V Scrolling Disabled: ", getSkin())).right();
                ImageTextButton vScrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                vScrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("vScrollDisabled", vScrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(vScrollCheckBox).left();
                vScrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("vScrollDisabled", vScrollCheckBox.isChecked());
                t.row();
                t.add(new Label("Force H Scroll: ", getSkin())).right();
                ImageTextButton forceHScrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                forceHScrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("forceHscroll", forceHScrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(forceHScrollCheckBox).left();
                forceHScrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("forceHscroll", forceHScrollCheckBox.isChecked());
                t.row();
                t.add(new Label("Force V Scroll: ", getSkin())).right();
                ImageTextButton forceVScrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                forceVScrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("forceVscroll", forceVScrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(forceVScrollCheckBox).left();
                forceVScrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("forceVscroll", forceVScrollCheckBox.isChecked());
                t.row();
                t.add(new Label("Variable Size Knobs: ", getSkin())).right();
                ImageTextButton variableSizeKnobsCheckBox = new ImageTextButton("", getSkin(), "switch");
                variableSizeKnobsCheckBox.setChecked(true);
                variableSizeKnobsCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("variableSizeKnobs", variableSizeKnobsCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(variableSizeKnobsCheckBox).left();
                variableSizeKnobsCheckBox.addListener(main.getHandListener());
                previewProperties.put("variableSizeKnobs", variableSizeKnobsCheckBox.isChecked());
                t.row();
                t.add(new Label("H Overscroll: ", getSkin())).right();
                ImageTextButton hOverscrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                hOverscrollCheckBox.setChecked(true);
                hOverscrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("hOverscroll", hOverscrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(hOverscrollCheckBox).left();
                hOverscrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("hOverscroll", hOverscrollCheckBox.isChecked());
                t.row();
                t.add(new Label("V Overscroll: ", getSkin())).right();
                ImageTextButton vOverscrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                vOverscrollCheckBox.setChecked(true);
                vOverscrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("vOverscroll", vOverscrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(vOverscrollCheckBox).left();
                vOverscrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("vOverscroll", vOverscrollCheckBox.isChecked());
                t.row();
                t.add(new Label("Fade Scroll Bars: ", getSkin())).right();
                ImageTextButton fadeScrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                fadeScrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("fadeScroll", fadeScrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(fadeScrollCheckBox).left();
                fadeScrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("fadeScroll", fadeScrollCheckBox.isChecked());
                t.row();
                t.add(new Label("Smooth Scrolling: ", getSkin())).right();
                ImageTextButton smoothScrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                smoothScrollCheckBox.setChecked(true);
                smoothScrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("smoothScroll", smoothScrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(smoothScrollCheckBox).left();
                smoothScrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("smoothScroll", smoothScrollCheckBox.isChecked());
                t.row();
                t.add(new Label("Flick Scroll: ", getSkin())).right();
                ImageTextButton flickScrollCheckBox = new ImageTextButton("", getSkin(), "switch");
                flickScrollCheckBox.setChecked(true);
                flickScrollCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("flickScroll", flickScrollCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(flickScrollCheckBox).left();
                flickScrollCheckBox.addListener(main.getHandListener());
                previewProperties.put("flickScroll", flickScrollCheckBox.isChecked());
                t.row();
                t.add(new Label("Clamp: ", getSkin())).right();
                ImageTextButton clampCheckBox = new ImageTextButton("", getSkin(), "switch");
                clampCheckBox.setChecked(true);
                clampCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("clamp", clampCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(clampCheckBox).left();
                clampCheckBox.addListener(main.getHandListener());
                previewProperties.put("clamp", clampCheckBox.isChecked());
                t.row();
                t.add(new Label("Sample Text: ", getSkin())).right();
                TextArea previewTextArea = new TextArea(PARAGRAPH_SAMPLE_EXT, getSkin());
                previewTextArea.setFocusTraversal(false);
                previewTextArea.setPrefRows(5);
                previewTextArea.addListener(main.getIbeamListener());
                previewTextArea.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", previewTextArea.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", previewTextArea.getText());
                t.add(previewTextArea).growX();
                previewSizeSelectBox.setSelectedIndex(2);
            } else if (clazz.equals(SelectBox.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                disabledCheckBox.addListener(main.getHandListener());
                t.add(disabledCheckBox).left();
                t.row();
                t.add(new Label("Max List Count: ", getSkin())).right();
                Spinner spinner = new Spinner(3, 1, true, Spinner.Orientation.HORIZONTAL, getSkin());
                spinner.getTextField().setFocusTraversal(false);
                spinner.setMinimum(1);
                spinner.getTextField().addListener(main.getIbeamListener());
                spinner.getButtonMinus().addListener(main.getHandListener());
                spinner.getButtonPlus().addListener(main.getHandListener());
                t.add(spinner).growX();
                t.row();
                t.add(new Label("List Items: ", getSkin())).right();
                TextArea listItemsTextArea = new TextArea("Lorem ipsum\ndolor sit\namet, consectetur", getSkin());
                listItemsTextArea.setFocusTraversal(false);
                listItemsTextArea.setPrefRows(3);
                listItemsTextArea.addListener(main.getIbeamListener());
                listItemsTextArea.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", listItemsTextArea.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", listItemsTextArea.getText());
                t.add(listItemsTextArea).growX();
            } else if (clazz.equals(Slider.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                disabledCheckBox.addListener(main.getHandListener());
                t.add(disabledCheckBox).left();
                t.row();
                t.add(new Label("Minimum: ", getSkin())).right();
                Spinner minimumSpinner = new Spinner(0.0f, 1.0f, false, Spinner.Orientation.HORIZONTAL, getSkin());
                minimumSpinner.getTextField().setFocusTraversal(false);
                minimumSpinner.getTextField().addListener(main.getIbeamListener());
                t.add(minimumSpinner).growX();
                minimumSpinner.getButtonMinus().addListener(main.getHandListener());
                minimumSpinner.getButtonPlus().addListener(main.getHandListener());
                previewProperties.put("minimum", minimumSpinner.getValue());
                t.row();
                t.add(new Label("Maximum: ", getSkin())).right();
                Spinner maximumSpinner = new Spinner(100.0f, 1.0f, false, Spinner.Orientation.HORIZONTAL, getSkin());
                maximumSpinner.getTextField().setFocusTraversal(false);
                maximumSpinner.getTextField().addListener(main.getIbeamListener());
                t.add(maximumSpinner).growX();
                maximumSpinner.getButtonMinus().addListener(main.getHandListener());
                maximumSpinner.getButtonPlus().addListener(main.getHandListener());
                previewProperties.put("maximum", maximumSpinner.getValue());
                minimumSpinner.setMaximum(maximumSpinner.getValue());
                maximumSpinner.setMinimum(minimumSpinner.getValue());
                minimumSpinner.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("minimum", minimumSpinner.getValue());
                        maximumSpinner.setMinimum(minimumSpinner.getValue());
                        refreshPreview();
                    }
                });
                maximumSpinner.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("maximum", maximumSpinner.getValue());
                        minimumSpinner.setMaximum(maximumSpinner.getValue());
                        refreshPreview();
                    }
                });
                t.row();
                t.add(new Label("Increment: ", getSkin())).right();
                Spinner incrementSpinner = new Spinner(1.0f, 1.0f, false, Spinner.Orientation.HORIZONTAL, getSkin());
                incrementSpinner.getTextField().setFocusTraversal(false);
                incrementSpinner.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("increment", incrementSpinner.getValue());
                        refreshPreview();
                    }
                });
                incrementSpinner.getTextField().addListener(main.getIbeamListener());
                t.add(incrementSpinner).growX();
                incrementSpinner.getButtonMinus().addListener(main.getHandListener());
                incrementSpinner.getButtonPlus().addListener(main.getHandListener());
                incrementSpinner.setMinimum(1.0f);
                previewProperties.put("increment", incrementSpinner.getValue());
                t.row();
                t.add(new Label("Orientation: ", getSkin())).right();
                SelectBox<String> selectBox = new SelectBox<>(getSkin());
                selectBox.setItems(new String[] { "Horizontal", "Vertical" });
                if (getSelectedStyle().name.contains("vert")) {
                    previewProperties.put("orientation", true);
                    selectBox.setSelectedIndex(1);
                } else {
                    previewProperties.put("orientation", false);
                }
                selectBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        if (selectBox.getSelectedIndex() == 0) {
                            previewProperties.put("orientation", false);
                        } else {
                            previewProperties.put("orientation", true);
                        }
                        refreshPreview();
                    }
                });
                selectBox.addListener(main.getHandListener());
                selectBox.getList().addListener(main.getHandListener());
                t.add(selectBox).growX();
            } else if (clazz.equals(SplitPane.class)) {
                t.row();
                t.add(new Label("Orientation: ", getSkin())).right();
                SelectBox<String> selectBox = new SelectBox<>(getSkin());
                selectBox.setItems(new String[] { "Horizontal", "Vertical" });
                if (getSelectedStyle().name.contains("vert")) {
                    previewProperties.put("orientation", true);
                    selectBox.setSelectedIndex(1);
                } else {
                    previewProperties.put("orientation", false);
                }
                selectBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        if (selectBox.getSelectedIndex() == 0) {
                            previewProperties.put("orientation", false);
                        } else {
                            previewProperties.put("orientation", true);
                        }
                        refreshPreview();
                    }
                });
                selectBox.addListener(main.getHandListener());
                selectBox.getList().addListener(main.getHandListener());
                t.add(selectBox).growX();
                t.row();
                t.add(new Label("Sample Text: ", getSkin())).right();
                TextArea textArea = new TextArea(PARAGRAPH_SAMPLE, getSkin());
                textArea.setFocusTraversal(false);
                textArea.setPrefRows(5);
                textArea.addListener(main.getIbeamListener());
                textArea.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", textArea.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", textArea.getText());
                t.add(textArea).growX();
                previewSizeSelectBox.setSelectedIndex(2);
            } else if (clazz.equals(TextButton.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                disabledCheckBox.addListener(main.getHandListener());
                t.add(disabledCheckBox).left();
                t.row();
                t.add(new Label("Text: ", getSkin())).right();
                TextField previewTextField = new TextField(TEXT_SAMPLE, getSkin());
                previewTextField.setFocusTraversal(false);
                previewTextField.addListener(main.getIbeamListener());
                previewTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", previewTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", previewTextField.getText());
                t.add(previewTextField).growX();
            } else if (clazz.equals(TextField.class)) {
                t.row();
                t.add(new Label("Disabled: ", getSkin())).right();
                ImageTextButton disabledCheckBox = new ImageTextButton("", getSkin(), "switch");
                disabledCheckBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("disabled", disabledCheckBox.isChecked());
                        refreshPreview();
                    }
                });
                previewProperties.put("disabled", disabledCheckBox.isChecked());
                disabledCheckBox.addListener(main.getHandListener());
                t.add(disabledCheckBox).left();
                t.row();
                t.add(new Label("Password Mode: ", getSkin())).right();
                ImageTextButton checkBox = new ImageTextButton("", getSkin(), "switch");
                checkBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("passwordMode", checkBox.isChecked());
                        refreshPreview();
                    }
                });
                t.add(checkBox).left();
                checkBox.addListener(main.getHandListener());
                previewProperties.put("passwordMode", checkBox.isChecked());
                t.row();
                t.add(new Label("Password Character: ", getSkin()));
                TextField pcTextField = new TextField("*", getSkin());
                pcTextField.setFocusTraversal(false);
                pcTextField.addListener(main.getIbeamListener());
                pcTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("password", pcTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("password", pcTextField.getText());
                t.add(pcTextField).growX();
                t.row();
                t.add(new Label("Text Alignment: ", getSkin())).right();
                SelectBox<String> selectBox = new SelectBox<>(getSkin());
                selectBox.setItems(new String[] { "Left", "Center", "Right" });
                selectBox.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        switch(selectBox.getSelectedIndex()) {
                            case 0:
                                previewProperties.put("alignment", Align.left);
                                break;
                            case 1:
                                previewProperties.put("alignment", Align.center);
                                break;
                            case 2:
                                previewProperties.put("alignment", Align.right);
                                break;
                        }
                        refreshPreview();
                    }
                });
                t.add(selectBox).growX();
                selectBox.addListener(main.getHandListener());
                selectBox.getList().addListener(main.getHandListener());
                previewProperties.put("alignment", Align.left);
                t.row();
                t.add(new Label("Text: ", getSkin())).right();
                TextField previewTextField = new TextField(TEXT_SAMPLE, getSkin());
                previewTextField.setFocusTraversal(false);
                previewTextField.addListener(main.getIbeamListener());
                previewTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", previewTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", previewTextField.getText());
                t.add(previewTextField).growX();
                t.row();
                t.add(new Label("Message Text: ", getSkin())).right();
                TextField messageTextField = new TextField(TEXT_SAMPLE, getSkin());
                messageTextField.setFocusTraversal(false);
                messageTextField.addListener(main.getIbeamListener());
                messageTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("message", messageTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("message", messageTextField.getText());
                t.add(messageTextField).growX();
            } else if (clazz.equals(TextTooltip.class)) {
                t.row();
                t.add(new Label("Text: ", getSkin())).right();
                TextField previewTextField = new TextField(TEXT_SAMPLE, getSkin());
                previewTextField.setFocusTraversal(false);
                previewTextField.addListener(main.getIbeamListener());
                previewTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", previewTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", previewTextField.getText());
                t.add(previewTextField).growX();
            } else if (clazz.equals(Touchpad.class)) {
            } else if (clazz.equals(Tree.class)) {
                t.row();
                t.add(new Label("Icon Spacing: ", getSkin())).right();
                Spinner spinner = new Spinner(0.0, 1.0, false, Spinner.Orientation.HORIZONTAL, getSkin());
                spinner.getTextField().setFocusTraversal(false);
                spinner.setMinimum(1);
                spinner.getTextField().addListener(main.getIbeamListener());
                spinner.getButtonMinus().addListener(main.getHandListener());
                spinner.getButtonPlus().addListener(main.getHandListener());
                t.add(spinner).growX();
                t.row();
                t.add(new Label("Y Spacing: ", getSkin())).right();
                spinner = new Spinner(0.0, 1.0, false, Spinner.Orientation.HORIZONTAL, getSkin());
                spinner.getTextField().setFocusTraversal(false);
                spinner.setMinimum(1);
                spinner.getTextField().addListener(main.getIbeamListener());
                spinner.getButtonMinus().addListener(main.getHandListener());
                spinner.getButtonPlus().addListener(main.getHandListener());
                t.add(spinner).growX();
            } else if (clazz.equals(Window.class)) {
                t.row();
                t.add(new Label("Title Text: ", getSkin())).right();
                TextField previewTextField = new TextField(TEXT_SAMPLE, getSkin());
                previewTextField.setFocusTraversal(false);
                previewTextField.addListener(main.getIbeamListener());
                previewTextField.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("title", previewTextField.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("title", previewTextField.getText());
                t.add(previewTextField).growX();
                t.row();
                t.add(new Label("Sample Text Color: ", getSkin()));
                BrowseField textColorField = new BrowseField(null, null, getSkin(), "color");
                textColorField.addListener(main.getHandListener());
                t.add(textColorField).growX();
                t.row();
                t.add(new Label("Sample Text: ", getSkin())).right();
                TextArea textArea = new TextArea(PARAGRAPH_SAMPLE, getSkin());
                textArea.setFocusTraversal(false);
                textArea.setPrefRows(5);
                textArea.addListener(main.getIbeamListener());
                textArea.addListener(new ChangeListener() {

                    @Override
                    public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                        previewProperties.put("text", textArea.getText());
                        refreshPreview();
                    }
                });
                previewProperties.put("text", textArea.getText());
                t.add(textArea).growX();
            }
            previewSizeSelectBox.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                    previewProperties.put("size", previewSizeSelectBox.getSelectedIndex());
                    if (previewSizeSelectBox.getSelectedIndex() != 7) {
                        refreshPreview();
                    }
                }
            });
            previewProperties.put("size", previewSizeSelectBox.getSelectedIndex());
            refreshPreview();
        } else {
            t.add(new Label("Stage Color: ", getSkin())).right();
            BrowseField browseField = new BrowseField(null, null, getSkin(), "color");
            browseField.addListener(new ChangeListener() {

                @Override
                public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                    main.getDialogFactory().showDialogColorPicker((Color) previewProperties.get("bgcolor"), new DialogColorPicker.ColorListener() {

                        @Override
                        public void selected(Color color) {
                            if (color != null) {
                                browseField.getTextButton().setText((int) (color.r * 255) + "," + (int) (color.g * 255) + "," + (int) (color.b * 255) + "," + (int) (color.a * 255));
                                previewProperties.put("bgcolor", color);
                                previewBgColor.set(color);
                                refreshPreview();
                            }
                        }
                    });
                }
            });
            browseField.addListener(main.getHandListener());
            t.add(browseField).growX();
            browseField.getTextButton().setText((int) (previewBgColor.r * 255) + "," + (int) (previewBgColor.g * 255) + "," + (int) (previewBgColor.b * 255) + "," + (int) (previewBgColor.a * 255));
        }
    }
}
Also used : ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Slider(com.badlogic.gdx.scenes.scene2d.ui.Slider) TextArea(com.badlogic.gdx.scenes.scene2d.ui.TextArea) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) TextTooltip(com.badlogic.gdx.scenes.scene2d.ui.TextTooltip) Actor(com.badlogic.gdx.scenes.scene2d.Actor) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) Tree(com.badlogic.gdx.scenes.scene2d.ui.Tree) ChangeListener(com.badlogic.gdx.scenes.scene2d.utils.ChangeListener) List(com.badlogic.gdx.scenes.scene2d.ui.List) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) Color(com.badlogic.gdx.graphics.Color) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)

Example 3 with ImageTextButton

use of com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton in project ProjektGG by eskalon.

the class LobbyScreen method initUI.

@Override
protected void initUI() {
    // backgroundTexture = assetManager.get(BACKGROUND_IMAGE_PATH);
    Sound clickSound = assetManager.get(BUTTON_SOUND);
    // mainTable.setBackground(skin.getDrawable("parchment-small"));
    ImageTextButton leaveButton = new ImageTextButton("Verlassen", skin);
    leaveButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            game.getNetworkHandler().disconnect();
            game.pushScreen("mainMenu");
            return true;
        }
    });
    NetworkHandler netHandler = game.getNetworkHandler();
    readyUpLobbyButton = new ImageTextButton("Bereit", skin);
    if (netHandler.isHost()) {
        readyUpLobbyButton.setDisabled(true);
        readyUpLobbyButton.setText("Spiel starten");
    }
    readyUpLobbyButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            getLocalPlayer().toggleReady();
            netHandler.onLocalPlayerChange(getLocalPlayer());
            updateLobbyUI();
            return true;
        }
    });
    Table playerTable = new Table();
    Table settingsTable = new Table();
    Table buttonTable = new Table();
    Table chatTable = new Table();
    // settings table + player table
    buttonTable.add(readyUpLobbyButton).bottom().padBottom(20).row();
    buttonTable.add(leaveButton);
    Table chatInputTable = new Table();
    ImageTextButton sendButton = new ImageTextButton("Senden", skin);
    TextField chatInputField = new TextField("", skin);
    chatInputField.setTextFieldListener(new TextFieldListener() {

        @Override
        public void keyTyped(TextField textField, char key) {
            if (!textField.getText().isEmpty() && (key == (char) 13)) {
                // Enter
                clickSound.play(1F);
                netHandler.sendChatMessage(chatInputField.getText());
                onNewChatMessage(new NewChatMessagEvent(localNetworkId, chatInputField.getText()));
                chatInputField.setText("");
            }
        }
    });
    sendButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            if (!chatInputField.getText().isEmpty()) {
                clickSound.play(1F);
                netHandler.sendChatMessage(chatInputField.getText());
                onNewChatMessage(new NewChatMessagEvent(localNetworkId, chatInputField.getText()));
                chatInputField.setText("");
            }
            return true;
        }
    });
    messagesArea = new TextArea("", skin);
    messagesArea.setDisabled(true);
    ScrollPane messagesPane = new ScrollPane(messagesArea);
    chatInputTable.add(chatInputField).left().width(325).padRight(15);
    chatInputTable.add(sendButton);
    chatTable.debug();
    chatTable.add(messagesPane).height(125).width(425).top().row();
    chatTable.add(chatInputTable).left().padTop(10).width(425).bottom();
    playerSlots = new Table[6];
    playerSlots[0] = new Table();
    playerSlots[1] = new Table();
    playerSlots[2] = new Table();
    playerSlots[3] = new Table();
    playerSlots[4] = new Table();
    playerSlots[5] = new Table();
    playerTable.add(playerSlots[0]).height(25).width(425).row();
    playerTable.add(playerSlots[1]).height(25).width(425).row();
    playerTable.add(playerSlots[2]).height(25).width(425).row();
    playerTable.add(playerSlots[3]).height(25).width(425).row();
    playerTable.add(playerSlots[4]).height(25).width(425).row();
    playerTable.add(playerSlots[5]).height(25).width(425).row();
    mainTable.add(playerTable).width(425).height(155);
    mainTable.add(settingsTable).width(155).row();
    mainTable.add(chatTable).height(165).bottom();
    mainTable.add(buttonTable).height(165);
    mainTable.setDebug(true);
// updateLobbyUI();
}
Also used : ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) TextArea(com.badlogic.gdx.scenes.scene2d.ui.TextArea) Sound(com.badlogic.gdx.audio.Sound) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) NewChatMessagEvent(de.gg.event.NewChatMessagEvent) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) NetworkHandler(de.gg.network.NetworkHandler) TextFieldListener(com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldListener) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Example 4 with ImageTextButton

use of com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton in project ProjektGG by eskalon.

the class MainMenuScreen method initUI.

@Override
protected void initUI() {
    backgroundTexture = assetManager.get(BACKGROUND_IMAGE_PATH);
    Sound clickSound = assetManager.get(BUTTON_SOUND);
    ImageTextButton multiplayerButton = new ImageTextButton("Multiplayer", skin);
    multiplayerButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            game.pushScreen("serverBrowser");
            return true;
        }
    });
    ImageTextButton settingsButton = new ImageTextButton("Einstellungen", skin);
    settingsButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            // Gdx.app.exit();
            return true;
        }
    });
    ImageTextButton exitButton = new ImageTextButton("Beenden", skin);
    exitButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            Gdx.app.exit();
            return true;
        }
    });
    Image logoImage = new Image((Texture) assetManager.get(LOGO_IMAGE_PATH));
    /*
		 * multiplayerButton .addListener(new TextTooltip("You can press this",
		 * skin));
		 */
    mainTable.add(logoImage).padBottom(25f).padTop(-120f);
    mainTable.row();
    mainTable.add(multiplayerButton).padBottom(11f);
    mainTable.row();
    mainTable.add(settingsButton).padBottom(11f);
    mainTable.row();
    mainTable.add(exitButton);
}
Also used : ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) Sound(com.badlogic.gdx.audio.Sound) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent) Image(com.badlogic.gdx.scenes.scene2d.ui.Image)

Example 5 with ImageTextButton

use of com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton in project ProjektGG by eskalon.

the class ServerBrowserScreen method initUI.

@Override
protected void initUI() {
    backgroundTexture = assetManager.get(BACKGROUND_IMAGE_PATH);
    Sound clickSound = assetManager.get(BUTTON_SOUND);
    // mainTable.setBackground(skin.getDrawable("parchment-small"));
    Table serverTable = new Table();
    ScrollPane pane = new ScrollPane(serverTable);
    // TODO gegen echte Server-Daten austauschen
    String ip = "127.0.0.1";
    int port = 12345;
    ImageTextButton joinButton = new ImageTextButton("Beitreten", skin);
    joinButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            game.getNetworkHandler().setUpConnectionAsClient(ip, port);
            connectingDialog = new Dialog("Verbinden...", skin);
            connectingDialog.text("Spiel beitreten...");
            connectingDialog.show(stage);
            return true;
        }
    });
    ImageTextButton backButton = new ImageTextButton("Zur�ck", skin);
    backButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            game.pushScreen("mainMenu");
            return true;
        }
    });
    ImageTextButton createLobbyButton = new ImageTextButton("Spiel erstellen", skin);
    createLobbyButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            game.pushScreen("lobbyCreation");
            return true;
        }
    });
    ImageTextButton directConnectButton = new ImageTextButton("Direkt verbinden", skin);
    directConnectButton.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            clickSound.play(1F);
            TextField portInputField = new TextField("55789", skin);
            portInputField.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
            TextField ipInputField = new TextField("127.0.0.1", skin);
            Dialog dialog = new Dialog("Direkt verbinden", skin) {

                public void result(Object obj) {
                    if ((Boolean) obj) {
                        game.getNetworkHandler().setUpConnectionAsClient(ipInputField.getText(), Integer.valueOf(portInputField.getText()));
                        connectingDialog = new Dialog("Verbinden...", skin);
                        connectingDialog.text("Spiel beitreten...");
                        connectingDialog.show(stage);
                    }
                }
            };
            dialog.text("IP: ").button("Zur�ck", false).button("Verbinden", true).key(Keys.ENTER, true).key(Keys.ESCAPE, false);
            dialog.getContentTable().add(ipInputField).width(170).row();
            dialog.getContentTable().add(new Label("Port:", skin));
            dialog.getContentTable().add(portInputField).width(90).left();
            dialog.show(stage);
            return true;
        }
    });
    Table buttonTable = new Table();
    buttonTable.add(backButton);
    buttonTable.add(createLobbyButton).padLeft(55);
    buttonTable.add(directConnectButton).padLeft(55);
    serverTable.left().top().add(new Image((Texture) assetManager.get(TICK_IMAGE_PATH))).padRight(15).padLeft(12);
    serverTable.add(new Label("Spiel 2", skin)).expandX();
    serverTable.add(joinButton).padRight(12);
    serverTable.row().padTop(20);
    mainTable.add(serverTable).width(580).height(405).row();
    mainTable.add(buttonTable).height(50).bottom();
}
Also used : Table(com.badlogic.gdx.scenes.scene2d.ui.Table) ImageTextButton(com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Sound(com.badlogic.gdx.audio.Sound) Image(com.badlogic.gdx.scenes.scene2d.ui.Image) Texture(com.badlogic.gdx.graphics.Texture) InputListener(com.badlogic.gdx.scenes.scene2d.InputListener) ScrollPane(com.badlogic.gdx.scenes.scene2d.ui.ScrollPane) Dialog(com.badlogic.gdx.scenes.scene2d.ui.Dialog) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) InputEvent(com.badlogic.gdx.scenes.scene2d.InputEvent)

Aggregations

ImageTextButton (com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton)9 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)7 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)7 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)6 Actor (com.badlogic.gdx.scenes.scene2d.Actor)5 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)5 InputListener (com.badlogic.gdx.scenes.scene2d.InputListener)5 Sound (com.badlogic.gdx.audio.Sound)4 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)4 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)4 SelectBox (com.badlogic.gdx.scenes.scene2d.ui.SelectBox)4 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)4 ChangeListener (com.badlogic.gdx.scenes.scene2d.utils.ChangeListener)4 Color (com.badlogic.gdx.graphics.Color)3 Texture (com.badlogic.gdx.graphics.Texture)3 Dialog (com.badlogic.gdx.scenes.scene2d.ui.Dialog)3 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)3 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)2 HorizontalGroup (com.badlogic.gdx.scenes.scene2d.ui.HorizontalGroup)2 ImageButton (com.badlogic.gdx.scenes.scene2d.ui.ImageButton)2