I'm working on a jframe program where I have 2 tabs (Home & About) .. now I would like to display a jlabel in the about tab only when a button is clicked , I managed to do that by using jLabel5.setVisible(true); ... it works fine , but when I go back to the home tab and go back
again to the about tab , the jlabel is gone so I have to press again so it can appear ... is there a way that I can make it stay there without it resetting everytime i switch tabs? thanks ... this is a gif showing what exactly my problem is http://imgur.com/LEaYQxL
Perhaps you could share the code, however there might be a work around, you could try to create a "flag" which is only a variable that is going to be true or false, create a variable flag that will change to true once you click in your button and then, when you pass to the About tab you will check if flag is true then jLabel5.setVisible(true) else jLabel5.setVisible(false), remember to initialize the flag variable as false.
You could try to make this: when you click the button you set the setVisible(true) and also set "true" a false boolean. So you click, the boolean wasClicked, that was false became true, and before you write if wasClicked is true: setVisible(true). A code example: