Esempio n. 1
0
  public void actionPerformed(ActionEvent e) {
    if (e.getSource() == ok) {

      if (w.equals("Richtig")) {
        Information[] infos = new Information[2];
        //				if (SudokuFenster1.getPreis().equals("20")) {
        infos[0] =
            new Information(
                Information.AENDERN_GELD,
                Information.ART_UM_WERT,
                Integer.parseInt(SudokuFenster1.getPreis()));
        infos[1] = new Information(Information.AENDERN_GELD, Information.ART_UM_WERT, -5);
        SudokuFenster1.getSpiel().minispielEnde(infos);
        //				} else if (SudokuFenster1.getPreis().equals("50")) {
        //					infos[0] = new Information(Information.AENDERN_GELD,
        //							Information.ART_UM_WERT, 50);
        //					SudokuFenster1.getSpiel().minispielEnde(infos);
        //				} else {
        //					infos[0] = new Information(Information.AENDERN_GELD,
        //							Information.ART_UM_WERT, 100);
        //					SudokuFenster1.getSpiel().minispielEnde(infos);
        //				}
      } else {
        Information[] infos = new Information[1];
        infos[0] = new Information(Information.AENDERN_GELD, Information.ART_UM_WERT, -5);
        SudokuFenster1.getSpiel().minispielEnde(infos);
      }
      this.setVisible(false);
      if (su2 != null) su2.setVisible(false);
      if (su != null) su.setVisible(false);
    }
  }
Esempio n. 2
0
  public String getGlück() {
    if (SudokuFenster1.getPreis().equals("20")) {
      zufall = new Random();
      r = zufall.nextInt(6);

      if (r == 0) {
        return "Sie haben bei der Verlosung 20 € gewonnen!";
      } else {
        return "Sie haben bei der Verlosung leider verloren!";
      }
    } else if (SudokuFenster1.getPreis().equals("50")) {
      zufall = new Random();
      r = zufall.nextInt(5);

      if (r == 0) {
        return "Sie haben bei der Verlosung 50 € gewonnen!";
      } else {
        return "Sie haben bei der Verlosung leider verloren!";
      }
    } else if (SudokuFenster1.getPreis().equals("100")) {
      zufall = new Random();
      r = zufall.nextInt(4);

      if (r == 0) {
        return "Sie haben bei der Verlosung 100 € gewonnen!";
      } else {
        return "Sie haben bei der Verlosung leider verloren!";
      }
    }
    return "Error";
  }