@Override
public void show()
{
stage=new Stage();
Gdx.input.setInputProcessor(stage);
// retrieve the default table actor
table = new Table( getSkin() );

final TextButton saveSpot1;
final TextButton saveSpot2;
final TextButton saveSpot3;
final TextButton saveSpot4;
final TextButton saveSpot5;
TextButton exitButton=new TextButton("Back",getSkin());
if(!datafh1.exists())
	saveSpot1= new TextButton("1", getSkin());
else {
	data1=Odczyt("data1.txt");
	saveSpot1= new TextButton(data1, getSkin());}
if(!datafh2.exists())
	saveSpot2= new TextButton("2", getSkin());
else {
	data2=Odczyt("data2.txt");
	saveSpot2= new TextButton(data2, getSkin());}
if(!datafh3.exists())
	saveSpot3= new TextButton("3", getSkin());
else {
	data3=Odczyt("data3.txt");
	saveSpot3= new TextButton(data3, getSkin());}
if(!datafh4.exists())
	saveSpot4= new TextButton("4", getSkin());
else {
	data4=Odczyt("data4.txt");
	saveSpot4= new TextButton(data4, getSkin());}
if(!datafh5.exists())
	saveSpot5= new TextButton("5", getSkin());
else {
	data5=Odczyt("data5.txt");
	saveSpot5= new TextButton(data5, getSkin());}
Texture backgroundTexture = new Texture(Gdx.files.internal("kulki1.jpg"));
Image backImage = new Image(backgroundTexture);
saveSpot1.addListener( new DefaultActorListener() {
    @Override
    public void touchUp(
        ActorEvent event,
        float x,
        float y,
        int pointer,
        int button )
    {
        super.touchUp( event, x, y, pointer, button );
        FileHandle fh=Gdx.files.local("zapis1.txt");
		fh.writeString(String.valueOf(pozx)+" "+String.valueOf(pozz)+" "+String.valueOf(index),false);
		data1=getDateTime();
		saveSpot1.setText(data1);
		 datafh1.writeString(data1,false);

    }
} );
saveSpot2.addListener( new DefaultActorListener() {
    @Override
    public void touchUp(
        ActorEvent event,
        float x,
        float y,
        int pointer,
        int button )
    {
        super.touchUp( event, x, y, pointer, button );
        FileHandle fh=Gdx.files.local("zapis2.txt");
    	fh.writeString(String.valueOf(pozx)+" "+String.valueOf(pozz)+" "+String.valueOf(index),false);
		data2=getDateTime();
		saveSpot2.setText(data2);
		 datafh2.writeString(data2,false);
    }
} );
saveSpot3.addListener( new DefaultActorListener() {
    @Override
    public void touchUp(
        ActorEvent event,
        float x,
        float y,
        int pointer,
        int button )
    {
        super.touchUp( event, x, y, pointer, button );
        FileHandle fh=Gdx.files.local("zapis3.txt");
    	fh.writeString(String.valueOf(pozx)+" "+String.valueOf(pozz)+" "+String.valueOf(index),false);
		data3=getDateTime();
		saveSpot3.setText(data3);
		 datafh3.writeString(data3,false);
    }
} );
saveSpot4.addListener( new DefaultActorListener() {
    @Override
    public void touchUp(
        ActorEvent event,
        float x,
        float y,
        int pointer,
        int button )
    {
        super.touchUp( event, x, y, pointer, button );
        FileHandle fh=Gdx.files.local("zapis4.txt");
    	fh.writeString(String.valueOf(pozx)+" "+String.valueOf(pozz)+" "+String.valueOf(index),false);
		data4=getDateTime();
		saveSpot4.setText(data4);
		 datafh4.writeString(data4,false);
    }
} );
saveSpot5.addListener( new DefaultActorListener() {
    @Override
    public void touchUp(
        ActorEvent event,
        float x,
        float y,
        int pointer,
        int button )
    {
        super.touchUp( event, x, y, pointer, button );
        FileHandle fh=Gdx.files.local("zapis5.txt");
    	fh.writeString(String.valueOf(pozx)+" "+String.valueOf(pozz)+" "+String.valueOf(index),false);
		data5=getDateTime();
		saveSpot5.setText(data5);
		 datafh5.writeString(data5,false);
    }
} );
exitButton.addListener( new DefaultActorListener() {
    @Override
    public void touchUp(
        ActorEvent event,
        float x,
        float y,
        int pointer,
        int button )
    {
        super.touchUp( event, x, y, pointer, button );
        game.setScreen(new MenuScreen(game));
    }
} );
System.out.println(pozx);
System.out.println(pozz);
table.setFillParent(true);
table.add( "Save your game" ).colspan( 3 );
table.row();
table.add(saveSpot1).width(200).height(40).padTop(10);
table.row();
table.add(saveSpot2).width(200).height(40).padTop(10);
table.row();
table.add(saveSpot3).width(200).height(40).padTop(10);
table.row();
table.add(saveSpot4).width(200).height(40).padTop(10);
table.row();
table.add(saveSpot5).width(200).height(40).padTop(10);
table.row();
table.add(exitButton).width(200).height(40).padTop(10);
stage.addActor(backImage);
stage.addActor(table);
}