Jump to content
  • Advertisement
Sign in to follow this  

[java] Making a button show?

This topic is 5006 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok I'm making a simple Java app, but I can't seem to get the button to show. The API documention isn't helping any, either. Here is the code:
import java.awt.*;
import java.awt.event.*;

class Calculator extends Frame {
	public Calculator() {
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {

	public static void main(String args[]) {
		System.out.println("Starting Calculator...");
		Calculator mainFrame = new Calculator();
		mainFrame.setSize(400, 400);
		Button addB = new Button("Add");

Am I doing something terribly wrong that the button won't show up? UPDATE: I'm an a bigger idiot than I thought, I didn't call mainFrame.add(add); .... [Edited by - Gunslinger RR on April 1, 2005 9:52:43 AM]

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!