I have got this JFrame which contain two JPanels directly on top of each other. The purpose is that when the user clicks the startButton on the top panel, it's going to disappear and the second panel is going to be displayed.
Bu whenever I click the startButton, all thats happening is that the button just freezes, and the JPanel isn't removed. I guess the whole app is freezing...
public class GameController implements ActionListener {
private JFrame frame;
private JPanel startPanel, ballPanel;
private JButton startButton;
public GameController(GameGUI gameGUI) {
this.frame = gameGUI.getFrame();
this.startPanel = gameGUI.getStartPanel();
this.ballPanel = gameGUI.getBallPanel();
this.startButton = gameGUI.getStartButton();
startButton.addActionListener(this);
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if(e.getSource().equals(startButton)) {
//frame.remove(startButton);
frame.remove(startPanel);
}
}
}

New Topic/Question
Reply




MultiQuote







|