I'm working on a basic Hidden object game for fun. Im not a professional coder by any means. At the main menu of the game (where you select start game, exit, resume, or how to play) I have 4 Jbuttons The button we are looking at is the how to play button. It makes a JPanel which displays a picture and some text (Explaining how to play the game etc) Now when you are done viewing that and you want to go back to the main menu to lets say start the game. The picture and text goes away but the custom cursors I was using for the buttons (You know when you hover the button the mouse cursor changes to my custom icons) stops working and its just the default arrow pointing thing. I've ruled out 2 possible problems, #1 is that the JPanel isn't being removed properly or #2 The cursors are not being set up properly after the JPanel is removed. Here is the code I use to remove the JPanel:
JButton nextPage = new JButton("Next Page");
HP.add(nextPage);
HP.setComponentZOrder(nextPage, 1);
nextPage.setBounds(560, 100, 100, 35);
nextPage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
pageNum++;
System.out.println("Page Number: "+pageNum);
if(pageNum > 2) {
//HP.remove(help);
//HP.remove(tut);
HP.removeAll();
gw.frame.revalidate();
gw.frame.repaint();
}
tut.setText("clicking the pause button at the bottom of\n the screen. There you will also find the\n items you are trying to find. The items you\n you have left to find will have a red X by\n them and the ones you've found will\n have a green 'CheckMark' by them.");
}
});`
HP is the panel gw.frame is the jframe I hope I explained this enough