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