diff options
Diffstat (limited to 'src/cppcheckplus/tab/MyTabPanelUI.java')
-rw-r--r-- | src/cppcheckplus/tab/MyTabPanelUI.java | 85 |
1 files changed, 40 insertions, 45 deletions
diff --git a/src/cppcheckplus/tab/MyTabPanelUI.java b/src/cppcheckplus/tab/MyTabPanelUI.java index b576d16..dea3a2e 100644 --- a/src/cppcheckplus/tab/MyTabPanelUI.java +++ b/src/cppcheckplus/tab/MyTabPanelUI.java | |||
@@ -1,53 +1,48 @@ | |||
1 | |||
2 | package cppcheckplus.tab; | 1 | package cppcheckplus.tab; |
3 | 2 | ||
3 | import cppcheckplus.control.MyContorlUtil; | ||
4 | import java.awt.FontMetrics; | 4 | import java.awt.FontMetrics; |
5 | import java.awt.Graphics; | 5 | import java.awt.Graphics; |
6 | import java.awt.Rectangle; | 6 | import java.awt.Rectangle; |
7 | import javax.swing.plaf.metal.MetalTabbedPaneUI; | 7 | import javax.swing.plaf.metal.MetalTabbedPaneUI; |
8 | 8 | ||
9 | import cppcheckplus.control.MyContorlUtil; | 9 | public class MyTabPanelUI extends MetalTabbedPaneUI { |
10 | 10 | private MyTabPanel tab; | |
11 | public class MyTabPanelUI extends MetalTabbedPaneUI | 11 | private int firstTabIndent; |
12 | { | 12 | |
13 | private MyTabPanel tab; | 13 | public MyTabPanelUI(MyTabPanel tab) { |
14 | private int firstTabIndent; | 14 | this.tab = null; |
15 | 15 | firstTabIndent = 5; | |
16 | public MyTabPanelUI(MyTabPanel tab) | 16 | this.tab = tab; |
17 | { | 17 | } |
18 | this.tab = null; | 18 | |
19 | firstTabIndent = 5; | 19 | protected Rectangle getTabBounds(int tabIndex, Rectangle dest) { |
20 | this.tab = tab; | 20 | Rectangle bounds = super.getTabBounds(tabIndex, dest); |
21 | } | 21 | bounds.x += firstTabIndent; |
22 | 22 | return bounds; | |
23 | protected Rectangle getTabBounds(int tabIndex, Rectangle dest) | 23 | } |
24 | { | 24 | |
25 | Rectangle bounds = super.getTabBounds(tabIndex, dest); | 25 | protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, |
26 | bounds.x += firstTabIndent; | 26 | int x, int y, int w, int h, |
27 | return bounds; | 27 | boolean isSelected) { |
28 | } | 28 | g.setColor(MyContorlUtil.TAB_BOTTOM_LINE_COLOR); |
29 | 29 | int lineY = tab.getPreferredTabHeight() - 1; | |
30 | protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, | 30 | g.drawLine(0, lineY, firstTabIndent, lineY); |
31 | boolean isSelected) | 31 | } |
32 | { | 32 | |
33 | g.setColor(MyContorlUtil.TAB_BOTTOM_LINE_COLOR); | 33 | protected void paintTabBackground(Graphics g1, int i, int j, int k, int l, |
34 | int lineY = tab.getPreferredTabHeight() - 1; | 34 | int i1, int j1, |
35 | g.drawLine(0, lineY, firstTabIndent, lineY); | 35 | boolean flag) { |
36 | } | 36 | } |
37 | 37 | ||
38 | protected void paintTabBackground(Graphics g1, int i, int j, int k, int l, int i1, int j1, | 38 | protected int calculateTabWidth(int tabPlacement, int tabIndex, |
39 | boolean flag) | 39 | FontMetrics metrics) { |
40 | { | 40 | int width = super.calculateTabWidth(tabPlacement, tabIndex, metrics); |
41 | } | 41 | return width - 5; |
42 | 42 | } | |
43 | protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics) | 43 | |
44 | { | 44 | protected int calculateTabHeight(int tabPlacement, int tabIndex, |
45 | int width = super.calculateTabWidth(tabPlacement, tabIndex, metrics); | 45 | int fontHeight) { |
46 | return width - 5; | 46 | return tab.getPreferredTabHeight(); |
47 | } | 47 | } |
48 | |||
49 | protected int calculateTabHeight(int tabPlacement, int tabIndex, int fontHeight) | ||
50 | { | ||
51 | return tab.getPreferredTabHeight(); | ||
52 | } | ||
53 | } | 48 | } |