already done the TIO one as follows:
do
{ dStr=JOptionPane.showInputDialog("Please enter "+name+"'s demand:");
d=console.nextInt();
if (d<0)
System.out.println("Demand can't be negative.");
}while(d<0);
but don't know how to transfer it into GUI style?
anyone can help me? Thx!!!!