我正在使用Netbeans,因此我使用拖放界面来创建GUI。
这是我的代码:
if (MenuOrder.BURGER == 1)
{
tableSalesFood.setValueAt("Cheeseburger",FastFoodProper.rowCount,0);
tableSalesFood.setValueAt("80.00",FastFoodProper.rowCount,2);
}
if (MenuOrder.FRIES == 1)
{
tableSalesFood.setValueAt("French Fries",FastFoodProper.rowCount,0);
tableSalesFood.setValueAt("40.00",FastFoodProper.rowCount,2);
}
if (MenuOrder.CHICKEN == 1)
{
tableSalesFood.setValueAt("Chicken w/Rice",FastFoodProper.rowCount,0);
tableSalesFood.setValueAt("100.00",FastFoodProper.rowCount,2);
}
if (MenuOrder.SALAD == 1)
{
tableSalesFood.setValueAt("Caesar Salad",FastFoodProper.rowCount,0);
tableSalesFood.setValueAt("90.00",FastFoodProper.rowCount,2);
}
if (MenuOrder.PIZZA == 1)
{
tableSalesFood.setValueAt("Pepperoni Pizza",FastFoodProper.rowCount,0);
tableSalesFood.setValueAt("300.00",FastFoodProper.rowCount,2);
}
if (MenuOrder.ONION == 1)
{
tableSalesFood.setValueAt("Onion Rings",FastFoodProper.rowCount,0);
tableSalesFood.setValueAt("50.00",FastFoodProper.rowCount,2)
} rowCount++;
返回错误:线程“AWT-EventQueue-0”中的异常java.lang.IllegalArgumentException:无法将给定的Object格式化为数字
但是,当我删除显示价格的底部时,它可以正常工作。但我的编程项目要求它显示食物描述和价格。我该怎么做?