title: TextFieldStyle in Libgdx
body: <p>Im trying to implement a different font than the default one using TextFieldStyle as I´ve been told. It´s inside a textbox that I want to change the font. But have yet not manage to do it.</p>
  
  <p>This is the class itself:</p>
  
  <pre><code>public class StoneScreen implements Screen {
  
  OrthographicCamera camera;
  final TombStone game;
  
  //Textures and art.
  public Texture background, sdStone, arrowBack;
  public Sprite backgrounds;
  
  //TextField´s stuff
  private Stage stage;
  private Skin skin;
  ImageButton btnArrow;
  
  
  
  
  public StoneScreen(TombStone gam)    {
      this.game = gam;
  
  
  
      camera = new OrthographicCamera();
      camera.setToOrtho(false, 136, 204);
  
      game.assets.load();
      loadStandard();
  
  
  
  
  
  }
  
  public void loadStandard(){
      background = game.assets.background;
      sdStone = game.assets.sdStone;
      //backgrounds = Assets.backgrounds;
  }
  
  
  
  @Override
  public void render(float delta) {
      Gdx.gl.glClearColor(0, 0, 0.2f,1);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  
      //Recieves the screen width and height
      float gameHeight = Gdx.graphics.getHeight();
      float gameWidth = Gdx.graphics.getWidth();
  
  
      camera.update();
      game.batch.setProjectionMatrix(camera.combined);
  
  
      game.batch.begin();
      Gdx.app.log("X", "FPS:" + Gdx.graphics.getFramesPerSecond());
  
  
  
      game.batch.draw(background,0,0, 136, 204);
  
      game.batch.draw(sdStone, 40, 20, 70, 110);
  
      //SpriteBatch batcher = (SpriteBatch)stage.getBatch();
  
  
      game.batch.end();
  
      stage.act(Gdx.graphics.getDeltaTime());
      stage.draw();
  }
  
  
  
  @Override
  public void resize(int width, int height) {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void show() {
  
  
  
      BitmapFont textFont;
  
      FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("NothingYouCouldDoBold.ttf"));
      FreeTypeFontParameter parameter = new FreeTypeFontParameter();
      parameter.size = 12;
      textFont = generator.generateFont(parameter);
  
  
  
  //String text = Gdx.app.getPreferences("prefs").getString("text", "Default text if missing");
  //String txtArea = Gdx.app.getPreferences("prefs").getString("text", "Default text if missing");
  Preferences prefs = Gdx.app.getPreferences("preferences");
  
  Skin skin = new Skin();
  Skin textSkin = new Skin();
  skin.add("font", textFont);
  
  stage = new Stage();
  Gdx.input.setInputProcessor(stage);
  skin = new Skin(Gdx.files.internal("uiskin.json"));
  
  TextFieldStyle textstyle = new TextFieldStyle();
  textstyle.font = textSkin.getFont("textFont");
  
  
  final TextArea textArea = new TextArea(prefs.getString("textArea", "Enter text:"), skin);
  textArea.setX(500);
  textArea.setY(500);
  textArea.setWidth(270);
  textArea.setHeight(270);
  textArea.setMaxLength(50);
  
  final TextField textField = new TextField(prefs.getString("textField", "Enter name:"), textstyle);
  
  
      textField.setX(500);
      textField.setY(750);
      textField.setMaxLength(20);
      //textField.setWidth(450);
      //textField.setHeight(200);
      textField.setSize(400, 200);
  
  
  
  
      //String text = Gdx.app.getPreferences("prefs").getString("text", "Default text if missimg");
      //TextField textField = new TextField(text, skin);
  
      //Backbutton 
              ImageButtonStyle styleTwo = new ImageButtonStyle();
              TextureRegionDrawable arrowImage = new TextureRegionDrawable(new TextureRegion(new Texture("arrowLeft.png")));
              styleTwo.up = skin.newDrawable(skin.newDrawable(arrowImage));
              styleTwo.down = skin.newDrawable(skin.newDrawable(arrowImage));
  
      btnArrow = new ImageButton(styleTwo);
  
      btnArrow.setSize(150, 150);
      btnArrow.setPosition(450, 10);
  
      stage.addActor(textArea);
      stage.addActor(textField);
      stage.addActor(btnArrow);
  
  
      //Backbutton takes us back to mainmenu
              btnArrow.addListener(new ChangeListener() {
  
                  @Override
                  public void changed(ChangeEvent event, Actor actor) {
                      game.setScreen(new MainScreen(game));
                      //Saves the entered text.
  
                      Preferences prefs = Gdx.app.getPreferences("preferences");
                      prefs.putString("textField", textField.getText());
                      prefs.putString("textArea", textArea.getText());
                      prefs.flush();
                  }
  
  
              });
  
  }
  
  @Override
  public void hide() {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void pause() {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void resume() {
      // TODO Auto-generated method stub
  
  }
  
  @Override
  public void dispose() {
      // TODO Auto-generated method stub
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>And the important part of this code is inside the Show() class. Where I´ve had no success with it. I get error saying : </p>
  
  <pre><code>09-20 17:26:22.606: D/dalvikvm(17329): Trying to load lib /data/app-lib/com.progrmor.tombstone.android-25/libgdx-freetype.so 0x42a968d0
  09-20 17:26:22.606: D/dalvikvm(17329): Added shared lib /data/app-lib/com.progrmor.tombstone.android-25/libgdx-freetype.so 0x42a968d0
  09-20 17:26:22.606: D/dalvikvm(17329): No JNI_OnLoad found in /data/app-lib/com.progrmor.tombstone.android-25/libgdx-freetype.so 0x42a968d0, skipping init
  09-20 17:26:22.887: W/dalvikvm(17329): threadid=11: thread exiting with uncaught exception (group=0x4189dda0)
  09-20 17:26:22.887: E/AndroidRuntime(17329): FATAL EXCEPTION: GLThread 30481
  09-20 17:26:22.887: E/AndroidRuntime(17329): Process: com.progrmor.tombstone.android, PID: 17329
  09-20 17:26:22.887: E/AndroidRuntime(17329): com.badlogic.gdx.utils.GdxRuntimeException: No com.badlogic.gdx.graphics.g2d.BitmapFont registered with name: textFont
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.ui.Skin.get(Skin.java:145)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.ui.Skin.getFont(Skin.java:175)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.progrmor.tombstone.screens.StoneScreen.show(StoneScreen.java:144)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.Game.setScreen(Game.java:61)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.progrmor.tombstone.screens.MainScreen$1.changed(MainScreen.java:142)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeListener.java:28)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:174)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:139)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.ui.Button.setChecked(Button.java:112)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.ui.Button$1.clicked(Button.java:86)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.utils.ClickListener.touchUp(ClickListener.java:89)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:57)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.scenes.scene2d.Stage.touchUp(Stage.java:342)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.backends.android.AndroidInput.processEvents(AndroidInput.java:382)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:413)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1531)
  09-20 17:26:22.887: E/AndroidRuntime(17329):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1248)
  09-20 17:26:27.111: E/AndroidGraphics(17329): waiting for pause synchronization took too long; assuming deadlock and killing
  </code></pre>
  
  <p>so.. what can I might be doing wrong here?</p>