Example usage for com.badlogic.gdx.scenes.scene2d.ui Container fillX

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Container fillX

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui Container fillX.

Prototype

float fillX

To view the source code for com.badlogic.gdx.scenes.scene2d.ui Container fillX.

Click Source Link

Usage

From source file:es.eucm.ead.editor.view.widgets.TextEditor.java

License:Open Source License

public TextEditor(Skin skin, TextEditorStyle style, I18N i18n, Preferences prefs) {

    float pad = WidgetBuilder.dpToPixels(8);
    pad(pad);/*from   w w  w .j a va  2  s . c o  m*/

    setBackground(style.background);

    this.i18n = i18n;

    final IconButton editLabel = new IconButton(SkinConstants.IC_EDIT, skin);
    text = " ";
    label = new Label(text, skin, SkinConstants.STYLE_TOOLBAR);
    label.setEllipsis(true);
    Container<Label> textContainer = new Container<Label>();
    Color color = skin.getColor(SkinConstants.COLOR_SEMI_BLACK);
    textContainer.setBackground(skin.getDrawable(SkinConstants.DRAWABLE_TEXT_FIELD));
    textContainer.setColor(color);
    textContainer.setActor(label);
    textContainer.fillX().width(0);

    colorPicker = new ColorPickerPanel(skin, style.colorPickerStyle, prefs);
    colorPicker.addListener(new ColorListener() {
        @Override
        public void colorChanged(ColorEvent event) {
            label.setColor(event.getColor());
        }
    });

    top = new Table();
    top.add(editLabel).pad(pad);
    top.add(textContainer).pad(pad).expandX().fillX();

    selectTypo = new SelectBox<String>(skin);
    selectTypo.getSelection().setProgrammaticChangeEvents(false);
    Array<String> typo = new Array<String>();
    typo.add("roboto");
    typo.add("comfortaa");
    typo.add("rabanera");
    selectTypo.setItems(typo);

    selectSize = new SelectBox<String>(skin);
    selectSize.getSelection().setProgrammaticChangeEvents(false);
    Array<String> size = new Array<String>();
    size.add(i18n.m("small"));
    size.add(i18n.m("big"));
    selectSize.setItems(size);

    LinearLayout fontOptions = new LinearLayout(true);
    fontOptions.add(selectTypo).marginRight(pad);
    fontOptions.add(selectSize).marginRight(pad);

    add(top).expandX().fillX();
    row();
    add(fontOptions).padBottom(pad);
    row();
    add(colorPicker).padBottom(pad);
    colorPicker.completeRowsIfPossible(this);
}