Java源码示例:com.badlogic.gdx.scenes.scene2d.ui.TextField.TextFieldStyle
示例1
public FilteredSelectBoxStyle(BitmapFont font, Color fontColor, Drawable background,
ScrollPaneStyle scrollStyle, ListStyle listStyle, TextFieldStyle textFieldStyle) {
this.font = font;
this.fontColor.set(fontColor);
this.background = background;
this.scrollStyle = scrollStyle;
this.listStyle = listStyle;
this.textFieldStyle = textFieldStyle;
}
示例2
public FilteredSelectBoxStyle(FilteredSelectBoxStyle style) {
this.font = style.font;
this.fontColor.set(style.fontColor);
if (style.disabledFontColor != null)
this.disabledFontColor = new Color(style.disabledFontColor);
this.background = style.background;
this.backgroundOver = style.backgroundOver;
this.backgroundOpen = style.backgroundOpen;
this.backgroundDisabled = style.backgroundDisabled;
this.scrollStyle = new ScrollPaneStyle(style.scrollStyle);
this.listStyle = new ListStyle(style.listStyle);
this.textFieldStyle = new TextFieldStyle(style.textFieldStyle);
}
示例3
public void resetProperties() {
properties.clear();
parent = null;
if (clazz.equals(Button.class)) {
newStyleProperties(ButtonStyle.class);
} else if (clazz.equals(CheckBox.class)) {
newStyleProperties(CheckBoxStyle.class);
properties.get("checkboxOn").optional = false;
properties.get("checkboxOff").optional = false;
properties.get("font").optional = false;
} else if (clazz.equals(ImageButton.class)) {
newStyleProperties(ImageButtonStyle.class);
} else if (clazz.equals(ImageTextButton.class)) {
newStyleProperties(ImageTextButtonStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(Label.class)) {
newStyleProperties(LabelStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(List.class)) {
newStyleProperties(ListStyle.class);
properties.get("font").optional = false;
properties.get("fontColorSelected").optional = false;
properties.get("fontColorUnselected").optional = false;
properties.get("selection").optional = false;
} else if (clazz.equals(ProgressBar.class)) {
newStyleProperties(ProgressBarStyle.class);
//Though specified as optional in the doc, there are bugs without "background" being mandatory
properties.get("background").optional = false;
} else if (clazz.equals(ScrollPane.class)) {
newStyleProperties(ScrollPaneStyle.class);
} else if (clazz.equals(SelectBox.class)) {
newStyleProperties(SelectBoxStyle.class);
properties.get("font").optional = false;
properties.get("fontColor").optional = false;
properties.get("scrollStyle").optional = false;
properties.get("scrollStyle").value = "default";
properties.get("listStyle").optional = false;
properties.get("listStyle").value = "default";
} else if (clazz.equals(Slider.class)) {
newStyleProperties(SliderStyle.class);
//Though specified as optional in the doc, there are bugs without "background" being mandatory
properties.get("background").optional = false;
} else if (clazz.equals(SplitPane.class)) {
newStyleProperties(SplitPaneStyle.class);
properties.get("handle").optional = false;
} else if (clazz.equals(TextButton.class)) {
newStyleProperties(TextButtonStyle.class);
properties.get("font").optional = false;
} else if (clazz.equals(TextField.class)) {
newStyleProperties(TextFieldStyle.class);
properties.get("font").optional = false;
properties.get("fontColor").optional = false;
} else if (clazz.equals(TextTooltip.class)) {
newStyleProperties(TextTooltipStyle.class);
properties.get("label").optional = false;
properties.get("label").value = "default";
} else if (clazz.equals(Touchpad.class)) {
newStyleProperties(TouchpadStyle.class);
} else if (clazz.equals(Tree.class)) {
newStyleProperties(TreeStyle.class);
properties.get("plus").optional = false;
properties.get("minus").optional = false;
} else if (clazz.equals(Window.class)) {
newStyleProperties(WindowStyle.class);
properties.get("titleFont").optional = false;
}
}
示例4
@Override
public void init() {
stage = new Stage();
// TODO memory manage
background = new Texture(Gdx.files.internal("textures/block/obsidian.png"));
background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
errorLabel = new Label(null, new LabelStyle(new BitmapFont(), Color.RED));
TextFieldStyle fieldStyle = new TextFieldStyle();
fieldStyle.font = new BitmapFont();
fieldStyle.fontColor = Color.WHITE;
TextField ipField = new TextField("IP:Port", fieldStyle);
ImageTextButtonStyle btnStyle = RadixClient.getInstance().getSceneTheme().getButtonStyle();
TextButton connectButton = new TextButton("Connect", btnStyle);
connectButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
String[] ipPort = ipField.getText().split(":");
if(ipPort.length != 2) {
invalidIpSyntax();
return;
}
try {
RadixClient.getInstance().enterRemoteWorld(ipPort[0], Short.parseShort(ipPort[1]));
} catch (NumberFormatException ex) {
invalidPort();
}
}
});
Table table = new Table();
table.setFillParent(true);
table.add(ipField);
table.row();
table.add(errorLabel);
table.row();
table.add(connectButton);
stage.addActor(table);
}