D:\NewZebra\JavaApplications\DesignPatternsProject\src\structural_patterns\pdf_facade_pattern\DummyObject.java |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package structural_patterns.pdf_facade_pattern;
21
22
23
24 @author
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 public class DummyObject implements Command {
35
36 String operationName = "None";
37
38
39 public DummyObject(String passedOperationName) {
40
41 operationName = passedOperationName;
42 }
43
44
45
46 public void execute(CommandPanel passedCommandPanel){
47 if(passedCommandPanel != null) {
48 passedCommandPanel.removeAll();
49 passedCommandPanel.setBackground(Color.white);
50 passedCommandPanel.setBackground(Color.red);
51
52 JLabel aJLabel = new JLabel("DummyObject " + operationName);
53 aJLabel.setFont(new Font("TimesRoman", Font.BOLD, 20));
54 aJLabel.setBounds(200, 200, 250,30);
55 aJLabel.setForeground(Color.black);
56 passedCommandPanel.add(aJLabel);
57 }
58 else
59 reportError();
60 }
61
62
63
64 public void reportError(){
65 JOptionPane.showMessageDialog(null, "DummyObject ", "Field Error", JOptionPane.ERROR_MESSAGE);
66 }
67 }
68
69