Skip to Main Content

Button filling my whole screen

843807May 27 2010 — edited May 28 2010
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();
		}
	}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked due to inactivity on Jun 25 2010
Added on May 27 2010
5 comments
471 views