我一直在使用 Scanner 来使用此代码,但我想使用 JOptionPane 来使用此代码,并带有 getPosNumber。我尝试了 compareTo(),但它不起作用。谢谢!
int height;
int length;
length = getPosNumber("What is the length of the rectangle?");
height = getPosNumber("What is the height of the rectangle?");
我一直在使用 Scanner 来使用此代码,但我想使用 JOptionPane 来使用此代码,并带有 getPosNumber。我尝试了 compareTo(),但它不起作用。谢谢!
int height;
int length;
length = getPosNumber("What is the length of the rectangle?");
height = getPosNumber("What is the height of the rectangle?");
length = getPosNumber( Integer.parseInt( JOptionPane.showInputDialog( "What is the length of the rectangle?")));
参考 API:http ://docs.oracle.com/javase/6/docs/api/javax/swing/JOptionPane.html