当前位置: 技术问答>java相关
紧急请教用什么函数判断输入的不是int类型?
来源: 互联网 发布时间:2015-02-28
本文导语: public void actionPerformed(ActionEvent e) { if(e.getSource()==capacityButton) { String capacityEntered=capacityField.getText(); // if capacity not entered ...
public void actionPerformed(ActionEvent e)
{
if(e.getSource()==capacityButton)
{
String capacityEntered=capacityField.getText();
// if capacity not entered
if(capacityEntered.length()==0)
{
displayArea.setText("Capacity of songs must be entered!");
}
// if capacity is out of range
else if(输入的不是int类型)
{
}
else if(Integer.parseInt(capacityEntered)
{
if(e.getSource()==capacityButton)
{
String capacityEntered=capacityField.getText();
// if capacity not entered
if(capacityEntered.length()==0)
{
displayArea.setText("Capacity of songs must be entered!");
}
// if capacity is out of range
else if(输入的不是int类型)
{
}
else if(Integer.parseInt(capacityEntered)