Пример #1
0
  public TheWorld() throws HeadlessException {
    super("This is the world, and God syas ...");
    p = new Panel();
    p.setBackground(Color.black);

    add(p);
    btnLand = new LetThereBeLandCommand("Let there be land", p);
    btnLight = new LetThereBeLightCommand("Let there be light", p);
    p.add(btnLand);
    p.add(btnLight);
    btnLight.addActionListener(this);
    btnLand.addActionListener(this);
    setBounds(100, 100, 400, 200);
    setVisible(true);
  }
Пример #2
0
  public TheWorld() {
    super("This is the world, and God says...");

    p = new Panel();
    p.setBackground(Color.black);

    add(p);
    btnLight = new LetThereBeLightCommand("Let there be light", p);
    btnLand = new LetThereBeLandCommand("Let there be land", p);
    btnReset = new ResetCommand("Reset", p);
    btnExit = new GodRestsCommand("God rests");

    p.add(btnLight);
    p.add(btnLand);
    p.add(btnReset);
    p.add(btnExit);

    btnLight.addActionListener(this);
    btnLand.addActionListener(this);
    btnReset.addActionListener(this);
    btnExit.addActionListener(this);
    setBounds(100, 100, 400, 200);
    setVisible(true);
  }