CardLayout (3)

class NextButton extends Button {
   NextButton(String name) {
      super(name);
   }
   public boolean action(Event evt, Object what) {
      Frame fr = (Frame) getParent();
      CardLayout card = (CardLayout) 
                        fr.getLayout();

      if (getLabel().equals("Btn 4")) {
         card.first(fr);
      } else {
         card.next(fr);
      }
      return true;
   }
}


Slide 93 ©Copyright 1997 Jan Newmarch