I've created a Java application that creates an instance of a class that extends Frame. This class contains a Button object. When drawing to the screen, no matter what dimensions the Frame has, the button fills the entire screen. Has anybody else had this problem? When debugging, I've found my button's dimensions are 0 and 0, and setting the size manually does not help.
final class StartScreen extends Frame implements ActionListener
{
private Button learnButton = new Button("Close");
public StartScreen()
{
super("Frame Name");
setSize(200, 200);
add(learnButton);
learnButton.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent e)
{
if(e.getSource() == learnButton)
{
dispose();
}
}
}