I have this problem with my Applet not showing Buttons, before I move the mouse over them. I googled it, and found out "validate();" might help. It did not. Maybe I did it wrong, but couldn't find any other solution. Here's my code:
public void paintMainMenu(){
Container conMain = getContentPane();
play = new JButton("Play");
credits = new JButton("Credits");
controls = new JButton("Controls");
FlowLayout lay1 = new FlowLayout();
JPanel mainPanel = new JPanel();
mainPanel.setSize(SW, SH);
mainPanel.setLayout(lay1);
mainPanel.add(play);
mainPanel.add(credits);
mainPanel.add(controls);
play.addActionListener(this);
credits.addActionListener(this);
controls.addActionListener(this);
conMain.add(mainPanel);
conMain.validate(); // Validation...
setContentPane(conMain);
}
I think the problem exists in here, but if you want full code just tell.
Thanks!