//-----------------------------------------------------------------------------// // WhileYouWereOut.java // // -------------------- // // This example is from Developer's Daily (http://www.DevDaily.com). // // Copyright (c) 1998 DevDaily Interactive, Inc. // // This example is provided WITHOUT ANY WARRANTY either expressed or implied. // // You may study, use, modify, and distribute it for non-commercial purposes. // // For any commercial use, contact our editor (editor@DevDaily.com). // //-----------------------------------------------------------------------------// // Version 1.0 // //-----------------------------------------------------------------------------// // This applet was partially generated with Symantec Visual Cafe. // //-----------------------------------------------------------------------------// import java.awt.*; import java.util.Date; import java.lang.*; public class MainFrame extends Frame { Date theDate; String dayOfWeek; String month; String dayOfMonth; String hh; String mm; String[] months = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; String[] days = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; String[] nums = { "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59" }; void sendMessageButton_Clicked(Event event) { //{{CONNECTION // Hide the Frame hide(); //}} } public MainFrame() { //{{INIT_CONTROLS setLayout(new BorderLayout(0,0)); addNotify(); resize(insets().left + insets().right + 323,insets().top + insets().bottom + 457); setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1 = new symantec.itools.awt.KeyPressManagerPanel(); keyPressManagerPanel1.setLayout(null); keyPressManagerPanel1.reshape(insets().left + 0,insets().top + 0,323,457); keyPressManagerPanel1.setBackground(new Color(13871015)); add("Center", keyPressManagerPanel1); label1 = new java.awt.Label("For:"); label1.reshape(18,33,24,16); label1.setFont(new Font("Dialog", Font.PLAIN, 12)); label1.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label1); label2 = new java.awt.Label("Date:"); label2.reshape(18,61,38,16); label2.setFont(new Font("Dialog", Font.PLAIN, 12)); label2.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label2); label4 = new java.awt.Label("Time:"); label4.reshape(170,62,36,16); label4.setFont(new Font("Dialog", Font.PLAIN, 12)); label4.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label4); label3 = new java.awt.Label("While You Were Out ..."); label3.reshape(83,2,164,23); label3.setFont(new Font("Dialog", Font.BOLD, 14)); keyPressManagerPanel1.add(label3); label5 = new java.awt.Label("Of:"); label5.reshape(18,94,25,16); label5.setFont(new Font("Dialog", Font.PLAIN, 12)); label5.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label5); label6 = new java.awt.Label("Message:"); label6.reshape(18,258,72,16); label6.setFont(new Font("Dialog", Font.PLAIN, 12)); label6.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label6); label7 = new java.awt.Label("Signed:"); label7.reshape(18,394,48,16); label7.setFont(new Font("Dialog", Font.PLAIN, 12)); label7.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label7); forChoice = new java.awt.Choice(); keyPressManagerPanel1.add(forChoice); forChoice.reshape(62,32,232,17); forChoice.setFont(new Font("Dialog", Font.PLAIN, 12)); dateTextField = new java.awt.TextField(); dateTextField.reshape(61,61,87,18); dateTextField.setFont(new Font("Dialog", Font.PLAIN, 11)); keyPressManagerPanel1.add(dateTextField); timeTextField = new java.awt.TextField(); timeTextField.reshape(220,61,74,18); timeTextField.setFont(new Font("Dialog", Font.PLAIN, 11)); keyPressManagerPanel1.add(timeTextField); ofTextField = new java.awt.TextField(); ofTextField.reshape(78,94,216,18); ofTextField.setFont(new Font("Dialog", Font.PLAIN, 11)); keyPressManagerPanel1.add(ofTextField); phoneTextField = new java.awt.TextField(); phoneTextField.reshape(97,118,197,18); phoneTextField.setFont(new Font("Dialog", Font.PLAIN, 11)); keyPressManagerPanel1.add(phoneTextField); faxTextField = new java.awt.TextField(); faxTextField.reshape(97,140,197,18); faxTextField.setFont(new Font("Dialog", Font.PLAIN, 11)); keyPressManagerPanel1.add(faxTextField); otherNumTextField = new java.awt.TextField(); otherNumTextField.reshape(97,162,197,18); otherNumTextField.setFont(new Font("Dialog", Font.PLAIN, 11)); keyPressManagerPanel1.add(otherNumTextField); label10 = new java.awt.Label("Other No:"); label10.reshape(18,162,48,16); label10.setFont(new Font("Dialog", Font.PLAIN, 12)); label10.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label10); label9 = new java.awt.Label("Fax:"); label9.reshape(18,140,39,16); label9.setFont(new Font("Dialog", Font.PLAIN, 12)); label9.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label9); calledCheckbox = new java.awt.Checkbox("Called"); calledCheckbox.reshape(19,193,81,13); calledCheckbox.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(calledCheckbox); returnedCallCheckbox = new java.awt.Checkbox("Returned your call"); returnedCallCheckbox.reshape(19,211,121,15); returnedCallCheckbox.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(returnedCallCheckbox); cameCheckbox = new java.awt.Checkbox("Came to see you"); cameCheckbox.reshape(19,229,118,15); cameCheckbox.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(cameCheckbox); pleaseCallCheckbox = new java.awt.Checkbox("Please call"); pleaseCallCheckbox.reshape(187,193,104,13); pleaseCallCheckbox.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(pleaseCallCheckbox); willCallAgainCheckbox = new java.awt.Checkbox("Will call again"); willCallAgainCheckbox.reshape(187,211,104,13); willCallAgainCheckbox.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(willCallAgainCheckbox); urgentCheckbox = new java.awt.Checkbox("Urgent"); urgentCheckbox.reshape(187,229,104,13); urgentCheckbox.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(urgentCheckbox); specialCheckbox = new java.awt.Checkbox("Special Attention"); specialCheckbox.reshape(187,247,112,13); specialCheckbox.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(specialCheckbox); msgTextArea = new java.awt.TextArea(); msgTextArea.setText(""); msgTextArea.reshape(18,279,276,101); msgTextArea.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(msgTextArea); signedTextField = new java.awt.TextField(); signedTextField.reshape(93,394,200,18); signedTextField.setFont(new Font("Dialog", Font.PLAIN, 11)); keyPressManagerPanel1.add(signedTextField); sendMessageButton = new java.awt.Button("Send Message"); sendMessageButton.reshape(115,424,91,27); sendMessageButton.setFont(new Font("Dialog", Font.PLAIN, 12)); keyPressManagerPanel1.add(sendMessageButton); label8 = new java.awt.Label("Phone:"); label8.reshape(18,118,47,16); label8.setFont(new Font("Dialog", Font.PLAIN, 12)); label8.setBackground(new Color(13871015)); keyPressManagerPanel1.add(label8); setTitle("While you were out ..."); setResizable(false); //}} //{{INIT_MENUS //}} // obtain a list of user names to be shown in the "For:" field getUserList(); // fill in the "Date:" and time fields fillDateTimeFields(); // make the data input begin in the "Of:" field ofTextField.requestFocus(); } /** * Determine the values for the date and time fields, and fill in those fields. */ public void fillDateTimeFields () { theDate = new Date(); dayOfWeek = days[theDate.getDay()]; month = months[theDate.getMonth()]; dayOfMonth = nums[theDate.getDate()]; hh = nums[theDate.getHours()]; mm = nums[theDate.getMinutes()]; dateTextField.setText(dayOfWeek + ", " + month + " " + dayOfMonth); timeTextField.setText(hh + ":" + mm); } /** * Obtain a list of users that will be shown in the "For:" field. * In an intranet setting, this might typically be acquired through a database query. */ public void getUserList () { forChoice.addItem("Advertising"); forChoice.addItem("Editor"); forChoice.addItem("Java"); forChoice.addItem("Perl"); forChoice.addItem("Unix"); } /** * Retrieve the user input and transmit the message. */ public void sendData () { // get the form properties, and fill in the data transmission methods here ... // + email // + database // + other } public MainFrame(String title) { this(); setTitle(title); } public synchronized void show() { move(50, 50); super.show(); } public boolean handleEvent(Event event) { if (event.id == Event.WINDOW_DESTROY) { hide(); // hide the Frame return true; } if (event.target == sendMessageButton && event.id == Event.ACTION_EVENT) { sendMessageButton_Clicked(event); return true; } return super.handleEvent(event); } //{{DECLARE_CONTROLS symantec.itools.awt.KeyPressManagerPanel keyPressManagerPanel1; java.awt.Label label1; java.awt.Label label2; java.awt.Label label4; java.awt.Label label3; java.awt.Label label5; java.awt.Label label6; java.awt.Label label7; java.awt.Choice forChoice; java.awt.TextField dateTextField; java.awt.TextField timeTextField; java.awt.TextField ofTextField; java.awt.TextField phoneTextField; java.awt.TextField faxTextField; java.awt.TextField otherNumTextField; java.awt.Label label10; java.awt.Label label9; java.awt.Checkbox calledCheckbox; java.awt.Checkbox returnedCallCheckbox; java.awt.Checkbox cameCheckbox; java.awt.Checkbox pleaseCallCheckbox; java.awt.Checkbox willCallAgainCheckbox; java.awt.Checkbox urgentCheckbox; java.awt.Checkbox specialCheckbox; java.awt.TextArea msgTextArea; java.awt.TextField signedTextField; java.awt.Button sendMessageButton; java.awt.Label label8; //}} //{{DECLARE_MENUS //}} }