/** * * FILE: DataDialog.java * * DataDialog provides the dialog box for hourly rate and job category * from the user. * * Compiled and tested with JDK 1.1.4 * * @author Chad (shod) Darby, darby@j-nine.com * @version v4.34am, 18 Feb 1998 * */ import java.awt.*; import java.awt.event.*; import DataDialogActionListener; public class DataDialog extends Dialog implements WindowListener { protected Frame myParent; protected Panel msgPanel; protected Panel dataPanel; protected Panel buttonsPanel; protected Button executeButton; protected Button cancelButton; protected TextField rateTextField; protected Choice jobCategoryChoice; protected String jobCategoryArray[] = {"Windows NT", "Solaris UNIX", "Macintosh", "Sony Playstation"}; protected String rateString = null; protected String jobCategoryString = null; public DataDialog(Frame parent, String theTitle, String theMessage) { super(parent, theTitle, true); myParent = parent; setLayout(new BorderLayout()); // add message msgPanel = new Panel(); msgPanel.add(new Label(theMessage)); add("North", msgPanel); // add data input fields dataPanel = new Panel(); dataPanel.setLayout(new FlowLayout()); dataPanel.add(new Label("Rate")); dataPanel.add(rateTextField = new TextField(8)); dataPanel.add(new Label(" Job Category")); dataPanel.add(jobCategoryChoice = new Choice()); // populate the choice list for (int i=0; i < jobCategoryArray.length; i++) jobCategoryChoice.addItem(jobCategoryArray[i]); add("Center", dataPanel); buttonsPanel = new Panel(); buttonsPanel.add(executeButton = new Button("Execute")); buttonsPanel.add(cancelButton = new Button("Cancel")); add("South", buttonsPanel); setSize(400, 150); // register listeners addWindowListener(this); executeButton.addActionListener( new DataDialogActionListener(this) ); cancelButton.addActionListener( new DataDialogActionListener(this) ); } public String getRate() { return rateString; } public void setRate(String aRate) { rateString = aRate; } public String getJobCategory() { return jobCategoryString; } public void setJobCategory(String aJobCategory) { jobCategoryString = aJobCategory; } public void windowClosing(WindowEvent event) { this.setVisible(false); } public void windowClosed(WindowEvent event) { } public void windowActivated(WindowEvent event) { } public void windowDeactivated(WindowEvent event) { } public void windowDeiconified(WindowEvent event) { } public void windowIconified(WindowEvent event) { } public void windowOpened(WindowEvent event) { } }