public void actionPerformed(ActionEvent e)
{
String command; 
command=e.getActionCommand();
if (command.equals("front"))
lay.previous("next"); 此处提示错误
else if (command.equals("next"))
lay.next("front"); 此处提示错误
}
我已经标记出错误的地方了呀!
帮我看看,谢谢了!

解决方案 »

  1.   

    previous
    public void previous(Container parent)
    Flips to the previous card of the specified container. If the currently visible card is the first one, this method flips to the last card in the layout. Parameters:
    parent - the name of the parent container in which to do the layout.看看这个,说明你的参数有问题!
      

  2.   

    我把出错地方的字符串改成对象了,也就是把NEXT,FORNT改成CP,编译没有错误,但是运行时候什么都没有,这是怎么了?
      

  3.   

    if (command.equals("front"))
    // lay.previous("next"); //此处提示错误
    lay.previous(cp);
    else if (command.equals("next"))
    // lay.next("front"); //此处提示错误
    lay.next(next);另外public mycard() 里
    c.add(sp);
    show();
      

  4.   

    弄错一个,应该是
    lay.next(cp);
    另外
    sp.add(previous);
    sp.add(next);  //<<<<  这里加上next按钮
    sp.add(cp);