summaryrefslogtreecommitdiffstats
path: root/src/cppcheckplus/shortcut/MyShortcutPanel.java
blob: 5d97b08a8010b1b089362d261d7d556535e6a94b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
已复制!
package cppcheckplus.shortcut; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Cursor; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Insets; import javax.swing.JPanel; import javax.swing.border.Border; import cppcheckplus.control.MyContorlUtil; import cppcheckplus.control.MyHeader; import cppcheckplus.control.MyList; import cppcheckplus.control.MyListSplitListener; import cppcheckplus.outlookpanel.MyOutlookList; import cppcheckplus.outlookpanel.MyOutlookPanelListItem; public class MyShortcutPanel extends JPanel{ private MyList list; private JPanel split; private MyHeader header; private MyListSplitListener splitListener; public MyTree mytree; public MyShortcutPanel() { super(); //list = new MyList(); split = new JPanel(new BorderLayout()); header = new MyHeader() { public void setShrink(boolean shrinked) { super.setShrink(shrinked); if (shrinked) split.setCursor(Cursor.getDefaultCursor()); else split.setCursor(Cursor.getPredefinedCursor(10)); } }; splitListener = new MyListSplitListener(header); mytree = new MyTree(); init(); } public void setData(MyShortcutItem[] items,MyShortcutItemClickListenter listenter) { //list.setListData(items); list.setListenter(listenter); } private void init() { setLayout(new BorderLayout()); JPanel rightInsetPane = new JPanel(); rightInsetPane.setPreferredSize(new Dimension(2, 0)); rightInsetPane.setBackground(MyContorlUtil.LIST_BACKGROUND); add(rightInsetPane, "East"); add(header, "North"); split.setBorder(new Border() { public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { g.setColor(MyContorlUtil.LIST_SPLIT_COLOR); g.drawLine(x, y, x, y + height); } public Insets getBorderInsets(Component c) { return new Insets(0, 1, 0, 0); } public boolean isBorderOpaque() { return true; } }); split.setOpaque(true); split.setPreferredSize(new Dimension(4, 0)); split.setBackground(MyContorlUtil.LIST_BACKGROUND); split.setCursor(Cursor.getPredefinedCursor(10)); split.addMouseListener(splitListener); split.addMouseMotionListener(splitListener); add(split, "West"); add(mytree, "Center"); //add(list, "Center"); } public MyList getList() { return list; } public void setTitle(String title) { header.setTitle(title); } public String getTitle() { return header.getTitle(); } public void setShrink(boolean shrinked) { header.setShrink(shrinked); } public boolean isShrinked() { return header.isShrinked(); } }