GUI tracking example.
Tracking Software Components
by Jerry Gao, Ph.D., Eugene Y. Zhu, and Simon Shim, Ph.D.
Listing 5. GUI tracking example.
import beantracker.tracker.*;
.... // other import package
public class loginWin extends Frame {
public TextField txtLogin = new TextField(12);
public JpasswordField txt Pwd = JpasswordField(12);
public loginWin (EventListener parent, IBeanTracker tracker)
{ super("Login");
WindowListener wlis = (WindowListener)tracker.genGUIListener();
ActionListener alis = (ActionListener)tracker.genGUIListener();
TextListener tlis = (TextListener)tracker.genGUIListener();
Button cmdOK = new Button ("Login");
Button cmdCancel = new Button ("Cancel");
cmdOK.addActionListener(alis);
cmdCancel.addActionListener(alis);
textLogin.addTextListener(tlis);
.....// GUI layout code
cmdOK.addActionListener((ActionListener)parent);
cmdCancel.addActionListener((ActionListener)parent);
// set size and location
addWindowListener(WindowListener) parent);
addWindowListener(wlise);
}
}
About the Authors
Jerry Gao, Ph.D. is a full-time faculty member in the Department of Computer Engineering at San Jose University and can be reached at [email protected].
Eugene Zhu works at SCSL USA Inc. and may be reached at [email protected].
Simon Shim, Ph.D. is a full-time faculty member in the Department of Computer Engineering at San Jose University and may be reached at [email protected].