Original Post
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: 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]
import java.awt.*;
import java.awt.event.*;
class Calculator extends Frame {
public Calculator() {
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
});
}
public static void main(String args[]) {
System.out.println("Starting Calculator...");
Calculator mainFrame = new Calculator();
mainFrame.setSize(400, 400);
mainFrame.setTitle("Calculator");
mainFrame.setVisible(true);
Button addB = new Button("Add");
addB.setSize(25,25);
addB.setLocation(100,100);
addB.setVisible(true);
}
}