/** * FILE: PersonButton.java * AUTHOR: Ivan J Leichtling * INERNET: ivan@columbia.edu * * This file defines a PersonButton, a button that when pressed will pop-up a * Frame for the person. */ import java.awt.*; public class PersonButton extends Button { Person p; public PersonButton( Person p ) { super( p.getName() ); this.p = p; p.setButton( this ); } public PersonButton( Person p, boolean bugFix ) { super( p.getName() ); this.p = p; //p.setButton( this ); } public boolean handleEvent( Event evt ) { if( evt.id == Event.ACTION_EVENT ) { if( p.getSex() == Person.MALE ) { new ManFrame( (Man)p ); } else { new WomanFrame( (Woman)p); } return( true ); } return( super.handleEvent( evt ) ); } }