本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.TextArea类的典型用法代码示例。如果您正苦于以下问题:Java TextArea类的具体用法?Java TextArea怎么用?Java TextArea使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TextArea类属于com.badlogic.gdx.scenes.scene2d.ui包,在下文中一共展示了TextArea类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
@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);
}
示例2: build
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
@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);
}
示例3: addTextArea
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
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);
}
示例4: DeveloperInfo
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
public DeveloperInfo(Skin skin, CenterWindowManager centerWindowManager) {
super("Dev Info", skin, centerWindowManager);
stats = new TextArea("", skin);
stats.setDisabled(true);
textAreaCell = this.add(stats);
}
示例5: createWidget
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
@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;
}
示例6: text
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
/**
* 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;
}
示例7: getHandledType
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
@Override
public Class<TextArea> getHandledType() {
return TextArea.class;
}
示例8: process
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final TextArea actor, final String rawAttributeData) {
actor.setPrefRows(parser.parseFloat(rawAttributeData, actor));
}
示例9: getNewInstanceOfTextField
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
@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;
}
示例10: addNormalWidgets
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
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();
}
示例11: text
import com.badlogic.gdx.scenes.scene2d.ui.TextArea; //导入依赖的package包/类
/**
* 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;
}