D:\NewZebra\JavaApplications\DesignPatternsProject\src\behavior_patterns\command_pattern_nested_menu\Three_Item_2.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
28 import java.text.*;
29 import java.util.*;
30 import java.awt.event.*;
31 import java.awt.*;
32 import javax.swing.*;
33
34
35 public class Three_Item_2 implements Command {
36
37
38 public Three_Item_2() {
39 }
40
41
42
43 public void execute(CommandPanel passedCommandPanel){
44 if(passedCommandPanel != null) {
45 passedCommandPanel.removeAll();
46 passedCommandPanel.setBackground(Color.gray);
47
48 JLabel aJLabel = new JLabel("Three_Item_2");
49 aJLabel.setFont(new Font("TimesRoman", Font.BOLD, 20));
50 aJLabel.setBounds(200, 200, 250,30);
51 aJLabel.setForeground(Color.black);
52 passedCommandPanel.add(aJLabel);
53 }
54 else
55 reportError();
56 }
57
58
59
60 public void reportError(){
61 JOptionPane.showMessageDialog(null, "Three_Item_2 ", "Field Error", JOptionPane.ERROR_MESSAGE);
62 }
63
64 }
65
66