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
|
package cppcheckplus.tab;
import cppcheckplus.control.MyContorlUtil;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import javax.swing.plaf.metal.MetalTabbedPaneUI;
public class MyTabPanelUI extends MetalTabbedPaneUI {
private MyTabPanel tab;
private int firstTabIndent;
public MyTabPanelUI(MyTabPanel tab) {
this.tab = null;
firstTabIndent = 5;
this.tab = tab;
}
protected Rectangle getTabBounds(int tabIndex, Rectangle dest) {
Rectangle bounds = super.getTabBounds(tabIndex, dest);
bounds.x += firstTabIndent;
return bounds;
}
protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex,
int x, int y, int w, int h,
boolean isSelected) {
g.setColor(MyContorlUtil.TAB_BOTTOM_LINE_COLOR);
int lineY = tab.getPreferredTabHeight() - 1;
g.drawLine(0, lineY, firstTabIndent, lineY);
}
protected void paintTabBackground(Graphics g1, int i, int j, int k, int l,
int i1, int j1,
boolean flag) {
}
protected int calculateTabWidth(int tabPlacement, int tabIndex,
FontMetrics metrics) {
int width = super.calculateTabWidth(tabPlacement, tabIndex, metrics);
return width - 5;
}
protected int calculateTabHeight(int tabPlacement, int tabIndex,
int fontHeight) {
return tab.getPreferredTabHeight();
}
}
|