I have created a Java application in Netbeans, and used CardLayout
to make three cards, which appear when I click three buttons.
All that is fine but I want to make a 'back' icon that, when clicked on, brings the previous card, so that if I am in the third card, clicking on the 'back' icon brings the second card, and from the second card to the first and so on.
The problem is that I want the program to know that we are in the second card for example, so clicking the 'back' icon brings the first card.
Also the back icon is on another panel in the same JFrame
. I hope someone helps!
The icon on the lower left is the back button and cards are located inside-the white portion.