Here is my code: For some reason nothing will appear on my screen, yet I don\'t know why, I believe I am initializing it correctly and adding it. Help?
import j
Call mainFrame.setVisible(true);
last
private void Start()
{
JFrame mainFrame = new JFrame("MineSweeper");
// Move this...
//mainFrame.setVisible(true);
//...
mainFrame.add(p1, BorderLayout.CENTER);
// To here
mainFrame.setVisible(true);
}
You should also launch you application with the context of the EDT. Take a look at Initial Threads for more details
You should also avoid using a MouseListener
on buttons, they have a ActionListener
API which includes notification when the use clicks the button or "active" key (usually Enter or Space)