There have been many times on StackOverflow where a user asks a question like this...
I have a main
JPanelthat contains a childJP
next() and prev() methods.Map for this purpose as it's already there for you. I've not infrequently used enums for this.repaint() and revalidate() when swapping components.I can't explain the reason for a down-vote though, unless they're upset you didn't mention the need to remember to call repaint() and revalidate() when swapping components. You'll have to ask the down-voter if they are brave enough to respond.