D:\NewZebra\JavaApplications\DesignPatternsProject\src\behavior_patterns\command_pattern_w_objects\Command_1.java |
1 /* 2 * Command_1.java 3 * 4 * Disclaimer: 5 * ZebraSoft.com disclaims all warrantees with regard to documents/programs, including 6 * all implied warranties. In no event shall ZebraSoft.com be liable for indirect or 7 * consequential damages or any damages whatsoever resulting from loss of use, data or 8 * profits arising out of the use of documents/programs. 9 * 10 * All content included on this site, such as text, graphics, logos, button icons, 11 * images, audio clips, video clips, digital downloads, programs, data compilations, 12 * and software, is the property of ZebraSoft.com or its content suppliers and 13 * protected by United States and international copyright laws. 14 * 15 * This site or any portion of this site may not be reproduced, duplicated, 16 * copied, sold, resold, visited, or otherwise exploited for any commercial 17 * purpose without express written consent of ZebraSoft.com. 18 */ 19 20 package behavior_patterns.command_pattern_w_objects; 21 22 /** 23 * 24 * @author Sam Eldin 25 */ 26 27 import java.text.*; 28 import java.util.*; 29 import java.awt.event.*; 30 import java.awt.*; 31 import javax.swing.*; 32 33 34 35 public class Command_1 implements Command { 36 37 /** Creates a new instance of Command_1 */ 38 public Command_1() { 39 } 40 /* 41 * 42 */ 43 public void execute(CommandPanel passedCommandPanel){ 44 if(passedCommandPanel != null) 45 passedCommandPanel.setBackground(Color.red); 46 else 47 reportError(); 48 } 49 /* 50 * 51 */ 52 public void reportError(){ 53 JOptionPane.showMessageDialog(null, "Command_1 ", "Field Error", JOptionPane.ERROR_MESSAGE); 54 55 } 56 57 } 58 59