images appear and disappear instantly

I made different tabs and when I press on a tab I want to "overwrite" and image that is currently on the screen. So far so good. I made a button to make an image appear but it only stays around for less than a second and vanishes again. I use the mousePressed function to make it work

submitted by /u/Famous_Cryptographer
[link] [comments]