I'm attempting to write a menu screen for a program, and am a complete noob at swing. I am using JLabel's to display the graphics that I have chosen for the buttons. At the moment the code for changing the menu screen is just under the MouseClicked method for the JLabel. So for one JLabel I will have;
public void MouseClicked(){
remove(all items in this screen);
add(all items for the next screen, dependant on which button was clicked);
}
This does work, but is extremely messy, and I am certain that their is a better way of doing it. Does anyone have any ideas? On how to neaten it up.