我创建了一个存储人员实例记录的商店。当从 CLI 添加员工时,它可以工作并且存储增量,当使用 swing 和 CLI 进行调试时,我可以看到新记录,但增量没有完成!
submit.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
Store recordStore;
recordStore = new Store(1);
// here add the submitting text
Employee em = new Employee("mn",'M', new Date(18,12,1991), "025", new Date(2,5,2009));
if (!Store.isFull())
{
recordStore.add(em);
recordStore.displayAll();
System.out.println("Current size of store is " + Store.getCount());
}
else
{ JOptionPane.showMessageDialog(null, "The store seems to be full, please save it, and create a new one!"); }
店铺添加功能
public void add(Person p)
{
// person p is added to array
list[count++] = p;
}