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

项目:JavityEngine    文件:JTextField.java   
private void createButton() {

        Skin skin = getGameObject().getComponentInParent(JCanvas.class).getSkin();
//      TextFieldStyle style = new TextFieldStyle(skin.get("default", TextFieldStyle.class));

        int realSize = (int) (((getTransform().getScale().x + getTransform().getScale().y) / 2) * fontSize);
        SmartFontGenerator fontGen = new SmartFontGenerator();
        FileHandle exoFile = Gdx.files.internal(fontResource.getResourcePath());
        BitmapFont fontBitmap = fontGen.createFont(exoFile, fontResource.getResourcePath() + realSize, realSize);

        TextFieldStyle styleDefault = skin.get("default", TextFieldStyle.class);
        TextFieldStyle style = new TextFieldStyle(fontBitmap, fontColor, styleDefault.cursor, styleDefault.selection, styleDefault.background);

        style.fontColor = fontColor;
        textField = new TextField(text, style);
        textField.addListener(new ChangeListener() {

            @Override
            public void changed(ChangeEvent event, Actor actor) {
                text = textField.getText();             
            }

        });

    }
项目:ead    文件:EditableLabelProccesor.java   
@Override
public Component getComponent(Label component) {
    Skin skin = gameAssets.getSkin();
    EditableLabelComponent button = gameLoop
            .createComponent(EditableLabelComponent.class);
    button.initialize(controller, component);
    button.setVariablesManager(variablesManager);

    TextFieldStyle style = skin.get(component.getStyle(),
            TextFieldStyle.class);
    TextFieldStyle styleCopy = new TextFieldStyle(style);
    button.setStyle(styleCopy);
    button.setText(gameAssets.getI18N().m(component.getText()));

    I18nTextComponent textComponent = gameLoop
            .createComponent(I18nTextComponent.class);
    textComponent.setI18nKey(component.getText());
    textComponent.setTextSetter(button);
    return new MultiComponent(button, textComponent);
}
项目:libgdx-inGameConsole    文件:GUIConsole.java   
protected ConsoleDisplay (Skin skin) {
    this.setFillParent(false);
    this.skin = skin;

    if (skin.has("console-font", BitmapFont.class))
        fontName = "console-font";
    else
        fontName = "default-font";

    TextFieldStyle tfs = skin.get(TextFieldStyle.class);
    tfs.font = skin.getFont(fontName);

    labels = new Array<Label>();

    logEntries = new Table(skin);

    input = new TextField("", tfs);
    input.setTextFieldListener(new FieldListener());

    scroll = new ScrollPane(logEntries, skin);
    scroll.setFadeScrollBars(false);
    scroll.setScrollbarsOnTop(false);
    scroll.setOverscroll(false, false);

    this.add(scroll).expand().fill().pad(4).row();
    this.add(input).expandX().fillX().pad(4);
    this.addListener(new KeyListener(input));
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
public void addTextField(String label, Object value, TextFieldListener lis) {
  Label l = new Label(label, skin.get(LabelStyle.class));
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  TextField t = new TextField(String.valueOf(value), skin.get(TextFieldStyle.class));
  t.setTextFieldListener(lis);
  t.setDisabled(false);
  t.setMaxLength(6);
  if (value instanceof Number)
    t.setTextFieldFilter((textField, c) -> Character.isDigit(c));
  table.add(t).right().padLeft(1f);

  table.row();
}
项目:tafl    文件:TaflGraphicsService.java   
@Override
public void onFinishLoading() {
    Skin skin = getSkin(Assets.Skin.UI_SKIN);
    BitmapFont menuFont = getFont(game.deviceSettings.menuFont);
    BitmapFont screenTitle = getFont(game.deviceSettings.screenTitleFont);
    BitmapFont hudFont = getFont(game.deviceSettings.hudFont);
    BitmapFont rulesFont = getFont(game.deviceSettings.rulesFont);

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextButtonStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, TextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ImageTextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ImageTextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).listStyle.font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).listStyle.font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, WindowStyle.class).titleFont = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, LabelStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_SCREEN_TITLE, LabelStyle.class).font = screenTitle;

    skin.get(Assets.Skin.SKIN_STYLE_GAME, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_PLAYER_TAG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_RULES, LabelStyle.class).font = rulesFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextFieldStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextFieldStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, CheckBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, CheckBoxStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ListStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ListStyle.class).font = hudFont;
}
项目:libgdx-chat-example    文件:ChatTextField.java   
public ChatTextField (String text, TextFieldStyle style) {
    setStyle(style);
    this.clipboard = Gdx.app.getClipboard();
    setText(text);
    setWidth(getPrefWidth());
    setHeight(getPrefHeight());
    initialize();
}
项目:the-erder    文件:GameManager.java   
@SuppressWarnings("deprecation")
   public static void LoadContent() {

    grass = new Texture(Gdx.files.internal("grass.png"));
    water = new Texture(Gdx.files.internal("Water.png"));
    stone = new Texture(Gdx.files.internal("Stone.png"));
    lava = new Texture(Gdx.files.internal("Lava.png"));
    swamp = new Texture(Gdx.files.internal("Swamp.png"));
    brick = new Texture(Gdx.files.internal("bricks.png"));
    notpassable = new Texture(Gdx.files.internal("notpassable.png"));
    passable = new Texture(Gdx.files.internal("passable.png"));
    texWidth = grass.getWidth();
    texHeight = grass.getWidth();
    FileHandle fontFile = Gdx.files.internal("./bin/data/fonts/tahoma.ttf");
       FreeTypeFontGenerator generator = new FreeTypeFontGenerator(
               fontFile);
       font = generator.generateFont(fontSize, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789����������������������������������������������������������������:][_!$%#@|\\/?-+=()*&.;,{}\"'<>",
               false);

       screenWidth = Gdx.graphics.getWidth();
       screenHeight = Gdx.graphics.getHeight();

       Vars.balancedScreenHeight = 1024 / screenHeight;
       Vars.balancedScreenWidth = 1280 / screenWidth;

    txtBtnStyle = new TextButtonStyle();
    txtBtnStyle.font = getFont();

    labelStyle = new LabelStyle();
    labelStyle.font = getFont();

    txtFieldStyle = new TextFieldStyle();
    txtFieldStyle.font = getFont();
    txtFieldStyle.fontColor = new Color(1, 1, 1, 1);

}
项目:ead    文件:EditableLabelComponent.java   
public void setStyle(TextFieldStyle style) {
    if (label == null) {
        label = new EditableLabel(text.getText(), style, DEFAULT_TAP_COUNT);
        label.initLabelListener(controller, text);
    } else {
        label.setStyle(style);
    }
}
项目:XMLLayoutParser    文件:ExampleGame.java   
/**
 * Setups a simple skin without any ressource
 *
 * @return A simple Skin
 */
private Skin setupSkin() {
    Skin skin = new Skin();

    Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
    pixmap.setColor(Color.WHITE);
    pixmap.fill();
    skin.add("white", new Texture(pixmap));

    skin.add("default", new BitmapFont());

    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.up = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.down = skin.newDrawable("white", Color.DARK_GRAY);
    textButtonStyle.over = skin.newDrawable("white", Color.LIGHT_GRAY);
    textButtonStyle.font = skin.getFont("default");
    skin.add("default", textButtonStyle);

    LabelStyle labelStyle = new LabelStyle();
    labelStyle.font = skin.getFont("default");
    labelStyle.fontColor = Color.BLACK;
    skin.add("default", labelStyle);

    LabelStyle redLabelStyle = new LabelStyle();
    redLabelStyle.font = skin.getFont("default");
    redLabelStyle.fontColor = Color.RED;
    skin.add("red", redLabelStyle);

    TextFieldStyle textFieldStyle = new TextFieldStyle();
    textFieldStyle.font = skin.getFont("default");
    textFieldStyle.fontColor = Color.BLACK;
    textFieldStyle.background = skin.newDrawable("white", Color.LIGHT_GRAY);
    skin.add("default", textFieldStyle);
    return skin;
}
项目:skin-composer    文件:StyleData.java   
public void resetProperties() {
    properties.clear();

    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;
    }
}
项目:skin-composer    文件:Spinner.java   
public SpinnerStyle(ButtonStyle buttonMinusStyle, ButtonStyle buttonPlusStyle, TextFieldStyle textFieldStyle) {
    this.buttonMinusStyle = buttonMinusStyle;
    this.buttonPlusStyle = buttonPlusStyle;
    this.textFieldStyle = textFieldStyle;
}
项目:Radix    文件:ServerConnectGUI.java   
@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);
}
项目:OdysseeDesMaths    文件:NewSave.java   
public NewSave(OdysseeDesMaths game) {
    this.game = game;

    viewport = new StretchViewport(WIDTH, HEIGHT);
    stage = new Stage(viewport);
    Gdx.input.setInputProcessor(stage);

    table = new Table();
    table.setFillParent(true);
    stage.addActor(table);

    skin = new Skin();
    skin.addRegions(Assets.getManager().get(Assets.UI_MAIN, TextureAtlas.class));
    skin.addRegions(Assets.getManager().get(Assets.UI_ORANGE, TextureAtlas.class));
    skin.add("background", Assets.getManager().get(Assets.MAIN_MENU_BACKGROUND, Texture.class));
    skin.add("title", new LabelStyle(TITLE, null));
    skin.add("text", new LabelStyle(TEXT, null));

    TextButtonStyle textButtonStyle = new TextButtonStyle();
    textButtonStyle.font = TEXT;
    textButtonStyle.up = skin.getDrawable("button");
    textButtonStyle.down = skin.getDrawable("button_pressed");
    skin.add("textButton", textButtonStyle);

    TextFieldStyle textFieldStyle = new TextFieldStyle();
    textFieldStyle.font = TEXT;
    textFieldStyle.fontColor = Color.BLACK;
    textFieldStyle.background = skin.getDrawable("field");
    textFieldStyle.focusedBackground = skin.getDrawable("field_focused");
    skin.add("textField", textFieldStyle);

    ButtonStyle returnButtonStyle = new ButtonStyle();
    returnButtonStyle.up = skin.getDrawable("return");
    skin.add("returnButton", returnButtonStyle);

    gameTitle = new Label("L'Odyssée des Maths", skin, "title");
    saveNameLabel = new Label("Nom:", skin, "text");
    saveNameField = new TextField("", skin, "textField");
    saveNameField.setMaxLength(7);
    submit = new TextButton("C'est parti !", skin, "textButton");
    audioButtons = new AudioButtons();
    returnButton = new Button(skin, "returnButton");

    table.setBackground(skin.getDrawable("background"));
    table.padTop(HEIGHT / 13);
    table.add(gameTitle).top().colspan(2).padBottom(HEIGHT / 9).expandX();
    table.row().padBottom(HEIGHT / 10);
    table.add(saveNameLabel).right().padRight(10);
    table.add(saveNameField).size(200, 48).left();
    table.row();
    table.add(submit).size(350, 64).top().colspan(2).expandY();
    table.row();
    table.add(audioButtons).left();
    table.add(returnButton).right();

    NewSaveListener listener = new NewSaveListener();
    submit.addListener(listener);
    returnButton.addListener(listener);

    noNameSubmitAction = new ColorAction();
    noNameSubmitAction.setEndColor(Color.WHITE);
    noNameSubmitAction.setDuration(0.5f);
}
项目:libgdx-chat-example    文件:ChatTextField.java   
public ChatTextField (String text, Skin skin) {
    this(text, skin.get(TextFieldStyle.class));
}
项目:libgdx-chat-example    文件:ChatTextField.java   
public ChatTextField (String text, Skin skin, String styleName) {
    this(text, skin.get(styleName, TextFieldStyle.class));
}
项目:libgdx-chat-example    文件:ChatTextField.java   
public void setStyle (TextFieldStyle style) {
    if (style == null) throw new IllegalArgumentException("style cannot be null.");
    this.style = style;
    invalidateHierarchy();
}
项目:libgdx-chat-example    文件:ChatTextField.java   
/** Returns the text field's style. Modifying the returned style may not have an effect until {@link #setStyle(TextFieldStyle)}
 * is called. */
public TextFieldStyle getStyle () {
    return style;
}
项目:gdx.automation    文件:StyleHelper.java   
public TextFieldStyle getTextFieldStyle() {
    return skin.get(TextFieldStyle.class);
}