Can't setVisible(false) on JPanel
I have this really (to me) odd problem. In the example code here the commented line gives me a "cannot find symbol method setVisible(boolean)" error. The funny thing is that it compiles (and runs) w/o problems if I replace that line with "w.setVisible(false)" or "c.setVisible(false)". Maybe it's something obvious that I missed but I checked it and couldn't. I'm sorry if it is.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
publicclass Apple2extends JFrameimplements ActionListener
{
JPanel m, w, c, e;
JButton newGame;
public Apple2()
{
setLayout(new GridBagLayout());
m =new JPanel(new BorderLayout(10, 0));
w =new JPanel();
c =new JPanel();
e =new JPanel();
w.setLayout(new BoxLayout(w, BoxLayout.PAGE_AXIS));
c.setLayout(new BoxLayout(c, BoxLayout.PAGE_AXIS));
e.setLayout(new BoxLayout(e, BoxLayout.PAGE_AXIS));
newGame =new JButton("New game");
JLabel playerIDlb =new JLabel("Player");
JProgressBar playerHPbar =new JProgressBar();
playerHPbar.setOrientation(JProgressBar.VERTICAL);
JLabel playerHPlb =new JLabel("Health");
JTextArea advLog =new JTextArea(12, 30);
JScrollPane advLogScroll =new JScrollPane(advLog);
JTextField cmdIn =new JTextField(30);
JLabel enemyIDlb =new JLabel("Enemy");
JProgressBar enemyHPbar =new JProgressBar();
enemyHPbar.setOrientation(JProgressBar.VERTICAL);
JLabel enemyHPlb =new JLabel("Health");
playerIDlb.setAlignmentX(Component.CENTER_ALIGNMENT);
playerHPbar.setAlignmentX(Component.CENTER_ALIGNMENT);
playerHPlb.setAlignmentX(Component.CENTER_ALIGNMENT);
enemyIDlb.setAlignmentX(Component.CENTER_ALIGNMENT);
enemyHPbar.setAlignmentX(Component.CENTER_ALIGNMENT);
enemyHPlb.setAlignmentX(Component.CENTER_ALIGNMENT);
add(newGame);
add(m);
m.add(w, BorderLayout.WEST);
m.add(c, BorderLayout.CENTER);
m.add(e, BorderLayout.EAST);
w.add(playerIDlb);
w.add(playerHPbar);
w.add(playerHPlb);
c.add(advLogScroll);
c.add(cmdIn);
e.add(enemyIDlb);
e.add(enemyHPbar);
e.add(enemyHPlb);
m.setVisible(false);
newGame.addActionListener(this);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setSize(500, 300);
setLocationRelativeTo(null);
setVisible(true);
}
publicvoid actionPerformed(ActionEvent e)
{
newGame.setVisible(false);
m.setVisible(true);
e.setVisible(false);// here is the culprit
}
publicstaticvoid main (String[] args)
{
new Apple2();
}
}

