1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
package jalview.appletgui; |
22 |
|
|
23 |
|
import java.awt.Frame; |
24 |
|
import java.awt.Graphics; |
25 |
|
import java.awt.Insets; |
26 |
|
import java.awt.Label; |
27 |
|
import java.awt.Panel; |
28 |
|
import java.awt.event.WindowAdapter; |
29 |
|
import java.awt.event.WindowEvent; |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 6 |
Complexity Density: 0.46 |
|
31 |
|
public class TitledPanel extends Panel |
32 |
|
{ |
33 |
|
|
34 |
|
private String title; |
35 |
|
|
36 |
|
private Insets insets = new Insets(10, 10, 10, 10); |
37 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
38 |
0 |
public TitledPanel()... |
39 |
|
{ |
40 |
0 |
this(""); |
41 |
|
} |
42 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
43 |
0 |
public TitledPanel(String title)... |
44 |
|
{ |
45 |
0 |
this.setTitle(title); |
46 |
|
} |
47 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
48 |
0 |
public Insets getInsets()... |
49 |
|
{ |
50 |
0 |
return insets; |
51 |
|
} |
52 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
53 |
0 |
public void paint(Graphics g)... |
54 |
|
{ |
55 |
0 |
super.paint(g); |
56 |
0 |
g.setColor(getForeground()); |
57 |
0 |
g.drawRect(5, 5, getWidth() - 10, getHeight() - 10); |
58 |
0 |
int width = g.getFontMetrics().stringWidth(getTitle()); |
59 |
0 |
g.setColor(getBackground()); |
60 |
0 |
g.fillRect(10, 0, width, 10); |
61 |
0 |
g.setColor(getForeground()); |
62 |
0 |
g.drawString(getTitle(), 10, 10); |
63 |
|
} |
64 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
65 |
0 |
public String getTitle()... |
66 |
|
{ |
67 |
0 |
return title; |
68 |
|
} |
69 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
70 |
0 |
public void setTitle(String title)... |
71 |
|
{ |
72 |
0 |
this.title = title; |
73 |
|
} |
74 |
|
} |