Ejemplo n.º 1
0
  public void paint(Graphics g) {
    super.paint(g);
    if (screen.equalsIgnoreCase("title")) {
      MyPanel.score = 0;
      hs = new Highscore();
      c.removeAll();
      c.add(ts);
      panel = null;
      ts.revalidate();
    } else if (screen.equalsIgnoreCase("instructions")) {
      c.removeAll();
      c.add(instructions);
      instructions.revalidate();
    } else if (screen.equalsIgnoreCase("mode")) {
      c.removeAll();
      c.add(mode);
      mode.revalidate();
    } else if (screen.equalsIgnoreCase("difficulty")) {
      c.removeAll();
      c.add(dif);
      dif.revalidate();
    } else if (screen.equalsIgnoreCase("highscore")) {
      if (hs.returnCount() == 0) {
        c.removeAll();
        c.add(hs);
        c.validate();
      }
    } else if (screen.equalsIgnoreCase("gameover")) {
      if (!once) {
        c.removeAll();
        c.add(gg);
        once = true;
        c.validate();
      }

    } else {
      if (once) {
        c.removeAll();
        panel = new MyPanel(THA.WIDTH, THA.HEIGHT, ai, diff);
        c.setLayout(new BorderLayout());
        c.add(panel.returnNs(), BorderLayout.WEST);
        c.add(panel, BorderLayout.CENTER);
        c.add(btns, BorderLayout.SOUTH);
        c.add(panel.returnAmmo(), BorderLayout.EAST);
        c.validate();
        once = false;
      }
    }
    repaint();
  }
Ejemplo n.º 2
0
 /** @return получить режи рисовоания */
 public int getMode() {
   return mode.ordinal();
 }