0

I want make a image button appear in the panel, but nothing draws.

Here is my code:

skin = new Skin(Gdx.files.internal("uiskin.json"));
texture1 = new Texture(Gdx.files.internal("badlogicsmall.jpg"));
texture2 = new Texture(Gdx.files.internal("badlogic.jpg"));
TextureRegion image = new TextureRegion(texture1);
TextureRegion imageFlipped = new TextureRegion(image);
imageFlipped.flip(true, true);
TextureRegion image2 = new TextureRegion(texture2);

ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
style.imageUp = new TextureRegionDrawable(image);
style.imageDown = new TextureRegionDrawable(imageFlipped);
ImageButton iconButton = new ImageButton(style);
style.imageUp = new TextureRegionDrawable(image);
style.imageDown = new TextureRegionDrawable(imageFlipped);

Any help is appreciated !

Thanks in advance !

Shajo
  • 873
  • 2
  • 11
  • 22

1 Answers1

0

I will try to guess... Did you add the ImageButton somehow to the Stage? (assuming you are using one).

If you have a Stage I would recommend to add a Table to the Stage (use addActor), and then add this ImageButton to the Table(use add).

nsacerdote
  • 431
  • 5
  • 8