diff options
Diffstat (limited to 'src/cppcheckplus/menu/MyMenuItem.java')
-rw-r--r-- | src/cppcheckplus/menu/MyMenuItem.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/cppcheckplus/menu/MyMenuItem.java b/src/cppcheckplus/menu/MyMenuItem.java new file mode 100644 index 0000000..6ac46e9 --- /dev/null +++ b/src/cppcheckplus/menu/MyMenuItem.java | |||
@@ -0,0 +1,52 @@ | |||
1 | |||
2 | package cppcheckplus.menu; | ||
3 | |||
4 | import java.awt.Color; | ||
5 | import java.awt.Dimension; | ||
6 | import javax.swing.BorderFactory; | ||
7 | import javax.swing.JMenuItem; | ||
8 | import javax.swing.border.Border; | ||
9 | |||
10 | import cppcheckplus.control.MyContorlUtil; | ||
11 | |||
12 | public class MyMenuItem extends JMenuItem | ||
13 | { | ||
14 | private static final long serialVersionUID = 1L; | ||
15 | private Color backgroundColor; | ||
16 | private Color foregroundColor; | ||
17 | private int borderThickness; | ||
18 | private Border border; | ||
19 | private int preferredHeight; | ||
20 | |||
21 | public MyMenuItem() | ||
22 | { | ||
23 | backgroundColor = MyContorlUtil.MENUITEM_BACKGROUND; | ||
24 | foregroundColor = MyContorlUtil.DEFAULT_TEXT_COLOR; | ||
25 | borderThickness = 1; | ||
26 | border = BorderFactory.createLineBorder(backgroundColor, borderThickness); | ||
27 | preferredHeight = 23; | ||
28 | init(); | ||
29 | } | ||
30 | public MyMenuItem(String text) | ||
31 | { | ||
32 | super(text); | ||
33 | backgroundColor = MyContorlUtil.MENUITEM_BACKGROUND; | ||
34 | foregroundColor = MyContorlUtil.DEFAULT_TEXT_COLOR; | ||
35 | borderThickness = 1; | ||
36 | border = BorderFactory.createLineBorder(backgroundColor, borderThickness); | ||
37 | preferredHeight = 23; | ||
38 | init(); | ||
39 | } | ||
40 | private void init() | ||
41 | { | ||
42 | setForeground(foregroundColor); | ||
43 | setFont(MyContorlUtil.FONT_14_BOLD); | ||
44 | setBackground(backgroundColor); | ||
45 | setBorder(border); | ||
46 | } | ||
47 | @Override | ||
48 | public Dimension getPreferredSize() | ||
49 | { | ||
50 | return new Dimension(super.getPreferredSize().width, preferredHeight); | ||
51 | } | ||
52 | } | ||