PPT Slide
Example 5: A simple GUI example (part A)
import java.awt.*;
public class AWTDemo extends Frame {
private Panel myPanel;
private Button myButton;
public AWTDemo() {
this.setBounds(0, 0, 200, 200);
myPanel = new Panel();
myPanel.setBackground(Color.red);
this.add(myPanel);
myButton = new Button();
myButton.setBounds(250, 250, 300, 300);
myButton.setLabel("Click me!");
myPanel.add(myButton);
} // end constractor
Previous slide
Next slide
Back to first slide
View graphic version