0

我一直在使用 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?");
4

1 回答 1

0
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

于 2012-11-05T08:07:37.693 回答