Java 类com.badlogic.gdx.scenes.scene2d.ui.TextArea 实例源码

项目:libgdxcn    文件:TextAreaTest.java   
@Override
public void create () {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextArea textArea = new TextArea(
        "Text Area\nEssentially, a text field\nwith\nmultiple\nlines.\n"
            + "It can even handle very loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong lines.",
        skin);
    textArea.setX(10);
    textArea.setY(10);
    textArea.setWidth(200);
    textArea.setHeight(200);

    TextField textField = new TextField("Text field", skin);
    textField.setX(10);
    textField.setY(220);
    textField.setWidth(200);
    textField.setHeight(30);
    stage.addActor(textArea);
    stage.addActor(textField);
}
项目:gaiasky    文件:MemInfoWindow.java   
@Override
protected void build() {
    float pad = 5 * GlobalConf.SCALE_FACTOR;
    float tawidth = 500 * GlobalConf.SCALE_FACTOR;

    String meminfostr = "";
    for (MemoryPoolMXBean mpBean : ManagementFactory.getMemoryPoolMXBeans()) {
        meminfostr += txt("gui.help.name") + ": " + mpBean.getName() + ": " + mpBean.getUsage() + "\n";
    }

    TextArea meminfo = new OwnTextArea(meminfostr, skin, "no-disabled");
    meminfo.setDisabled(true);
    meminfo.setPrefRows(10);
    meminfo.setWidth(tawidth);
    meminfo.clearListeners();

    meminfoscroll = new OwnScrollPane(meminfo, skin, "minimalist-nobg");
    meminfoscroll.setWidth(tawidth);
    meminfoscroll.setForceScroll(false, true);
    meminfoscroll.setSmoothScrolling(true);
    meminfoscroll.setFadeScrollBars(false);

    add(meminfoscroll).align(Align.center).pad(pad);

}
项目:JavityEngine    文件:JXmlUi.java   
private void addTextArea(Table table, Element element) {
    ObjectMap<String, String> atrributes = element.getAttributes();

    TextArea textArea = new TextArea(element.get("text", ""), skin);
    Cell<TextArea> cell = table.add(textArea);

    for (String key : atrributes.keys()) {
        if (key.equalsIgnoreCase("name")) {
            textArea.setName(atrributes.get(key));
        }
    }
    cellPrepare(cell, atrributes);
    actorsMap.put(textArea.getName(), textArea);

}
项目:DungeonCrawler    文件:DeveloperInfo.java   
public DeveloperInfo(Skin skin, CenterWindowManager centerWindowManager) {
    super("Dev Info", skin, centerWindowManager);
    stats = new TextArea("", skin);
    stats.setDisabled(true);

    textAreaCell = this.add(stats);
}
项目:DungeonCrawler    文件:DeveloperInfo.java   
public DeveloperInfo(Skin skin, CenterWindowManager centerWindowManager) {
    super("Dev Info", skin, centerWindowManager);
    stats = new TextArea("", skin);
    stats.setDisabled(true);

    textAreaCell = this.add(stats);
}
项目:ead    文件:UITest.java   
@Override
public AbstractWidget createWidget(Controller controller) {
    Skin skin = controller.getApplicationAssets().getSkin();
    LinearLayout layout = new LinearLayout(false);
    layout.add(new Label("This a test label with some text.", skin));
    layout.add(new TextField("This a text field with some text", skin));
    TextArea textArea = new TextArea(
            "This is a text area with some text \nin \nseveral \nlines",
            skin);
    textArea.setPrefRows(10);
    layout.add(textArea);
    SelectBox<String> selectBox = new SelectBox<String>(skin);
    String[] items = new String[200];
    for (int i = 0; i < 200; i++) {
        items[i] = "String " + i;
    }
    selectBox.setItems(items);
    layout.add(selectBox);
    layout.add(new Spinner(skin, 0.1f));

    // Buttons
    LinearLayout buttonsLayout = new LinearLayout(true);
    buttonsLayout.add(new Label("Buttons: ", skin));
    buttonsLayout.add(new Button(skin));
    buttonsLayout.add(new TextButton("Button with text", skin));
    buttonsLayout.add(new ImageButton(skin.getDrawable("undo24x24"), skin
            .getDrawable("redo24x24")));
    layout.add(buttonsLayout);
    // layout.add(new Slider(0, 10, 1, false, skin));
    return layout;
}
项目:ead    文件:OptionsController.java   
/**
 * Creates a text option (text area)
 * 
 * @param field
 *            the field
 * @param widgetLines
 *            lines to be shown by the widget
 */
public StringController text(String field, int widgetLines) {
    Option option = panel.text(label(field), tooltip(field), widgetLines);
    TextArea textArea = (TextArea) option.getOptionWidget();
    StringController value = newValueController(StringController.class,
            textArea);
    add(field, option, value);
    return value;
}
项目:gdx-lml    文件:PrefRowsLmlAttribute.java   
@Override
public Class<TextArea> getHandledType() {
    return TextArea.class;
}
项目:gdx-lml    文件:PrefRowsLmlAttribute.java   
@Override
public void process(final LmlParser parser, final LmlTag tag, final TextArea actor, final String rawAttributeData) {
    actor.setPrefRows(parser.parseFloat(rawAttributeData, actor));
}
项目:gdx-lml    文件:TextAreaLmlTag.java   
@Override
protected TextField getNewInstanceOfTextField(final TextLmlActorBuilder textBuilder) {
    final TextArea textArea = new TextArea(textBuilder.getText(), getSkin(textBuilder), textBuilder.getStyleName());
    LmlUtilities.getLmlUserObject(textArea).setData(Boolean.TRUE); // Setting as multiline by default.
    return textArea;
}
项目:vis-editor    文件:TestTextAreaAndScroll.java   
private void addNormalWidgets () {
    Skin skin = VisUI.getSkin();

    TextArea textArea = new TextArea("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis odio.", skin);
    textArea.setPrefRows(5);

    // ---

    VisTable table = new VisTable();

    for (int i = 0; i < 20; i++)
        table.add(new Label("Label #" + (i + 1), skin)).expand().fill().row();

    ScrollPane scrollPane = new ScrollPane(table, skin, "list");
    scrollPane.setFlickScroll(false);
    scrollPane.setFadeScrollBars(false);

    // ---

    add(textArea).row();
    add(scrollPane).spaceTop(8).fillX().expandX().row();
}
项目:ead    文件:OptionsPanel.java   
/**
 * Creates a text option, with a text area as widget
 * 
 * @param label
 *            the label for the option
 * @param tooltip
 *            the tooltip for the option (can be null)
 * @param maxLines
 *            the number of lines for the text area
 * @return the option created
 */
public Option text(String label, String tooltip, int maxLines) {
    TextArea textArea = new TextArea("", skin);
    textArea.setPrefRows(maxLines);
    Option option = newOption(label, tooltip, textArea);
    addOption(option);
    return option;
}