如何使用JOptionPane.showInputDialog创建数字限制(null,"");

时间:2016-02-10 18:31:35

标签: java

所以我正在制作一个你可以看到的游戏,但我需要制作它以便玩家不能使用超过28个统计点。 有人可以帮忙吗? 这是我的代码。

package fallout.pkg4.game;

导入javax.swing.JOptionPane;

公共课Fallout4Game {

public static void main(String[] args)
{
  int pointsint2;

  int pointsint;
  String points;
  String points2;

  int resultint;
  String perc;
  int resultPerc;

  int result3;
  String end;
  int endParsed;

  int result4;
  String chari;
  int chariParsed;

  int result5;
  String inte;
  int inteParsed;

  int result6;
  String agi;
  int agiParsed;

  int result7;
  String luck;
  int luckParsed;

  Boolean error;

  points = JOptionPane.showInputDialog(null, "Welcome to Brandons first game. Please enter 28 to start.");

  JOptionPane.showMessageDialog(null,"You have " + points + " stats points. Choose wisley.....");

  JOptionPane.showMessageDialog(null,"You will be choosing your S.P.E.C.I.A.L. attributes");

  points2 = JOptionPane.showInputDialog(null, "STRENGTH You have " + points + " points.");

  if(JOptionInput <= then )

  pointsint = Integer.parseInt(points);
  pointsint2 = Integer.parseInt(points2);
  resultint = pointsint - pointsint2;

  perc = JOptionPane.showInputDialog(null,"PERCEPTION You have " + resultint + " points left");

  resultPerc = Integer.parseInt(perc);
  result3 = resultint - resultPerc;

  end = JOptionPane.showInputDialog(null,"ENDURENCE You have " + result3 + " points left.");

  endParsed = Integer.parseInt(end);
  result4 = result3 - endParsed;

  chari = JOptionPane.showInputDialog(null,"CHARISMA You have " + result4 + " points left.");

  chariParsed = Integer.parseInt(chari);
  result5 = result4 - chariParsed;

  inte = JOptionPane.showInputDialog(null,"INTELIGENCE You have " + result5 + " points left.");

  inteParsed = Integer.parseInt(inte);
  result6 = result5 - inteParsed;

  agi = JOptionPane.showInputDialog(null,"AGILITY You have " + result6 + " points left");

  agiParsed = Integer.parseInt(agi);
  result7 = agiParsed - result6;

  luck = JOptionPane.showInputDialog(null,"LUCK You have " + result7 + " points left");

  luckParsed = Integer.parseInt(luck);

}

}

0 个答案:

没有答案