Пример #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();
  }
Пример #2
0
  public void updateMode() {
    Mode mode = editor.getMode();
    bgcolor =
        new Color[] {
          mode.getColor("status.notice.bgcolor"),
          mode.getColor("status.error.bgcolor"),
          mode.getColor("status.edit.bgcolor")
        };

    fgcolor =
        new Color[] {
          mode.getColor("status.notice.fgcolor"),
          mode.getColor("status.error.fgcolor"),
          mode.getColor("status.edit.fgcolor")
        };

    font = mode.getFont("status.font");
    metrics = null;
  }
Пример #3
0
 /** @return получить режи рисовоания */
 public int getMode() {
   return mode.ordinal();
 }