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.Color; |
24 |
|
import java.awt.Cursor; |
25 |
|
import java.awt.Dimension; |
26 |
|
import java.awt.Panel; |
27 |
|
import java.awt.event.MouseEvent; |
28 |
|
import java.awt.event.MouseListener; |
29 |
|
import java.awt.event.MouseMotionListener; |
30 |
|
|
|
|
| 0% |
Uncovered Elements: 32 (32) |
Complexity: 10 |
Complexity Density: 0.45 |
|
31 |
|
public class IdwidthAdjuster extends Panel |
32 |
|
implements MouseListener, MouseMotionListener |
33 |
|
{ |
34 |
|
boolean active = false; |
35 |
|
|
36 |
|
int oldX = 0; |
37 |
|
|
38 |
|
AlignmentPanel ap; |
39 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
40 |
0 |
public IdwidthAdjuster(AlignmentPanel ap)... |
41 |
|
{ |
42 |
0 |
setLayout(null); |
43 |
0 |
this.ap = ap; |
44 |
0 |
setBackground(Color.WHITE); |
45 |
0 |
addMouseListener(this); |
46 |
0 |
addMouseMotionListener(this); |
47 |
|
} |
48 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
49 |
0 |
@Override... |
50 |
|
public void mousePressed(MouseEvent evt) |
51 |
|
{ |
52 |
0 |
oldX = evt.getX(); |
53 |
|
} |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
55 |
0 |
@Override... |
56 |
|
public void mouseReleased(MouseEvent evt) |
57 |
|
{ |
58 |
0 |
active = false; |
59 |
0 |
repaint(); |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
} |
81 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
82 |
0 |
@Override... |
83 |
|
public void mouseEntered(MouseEvent evt) |
84 |
|
{ |
85 |
0 |
active = true; |
86 |
0 |
setCursor(Cursor.getPredefinedCursor(Cursor.W_RESIZE_CURSOR)); |
87 |
|
|
88 |
0 |
repaint(); |
89 |
|
} |
90 |
|
|
|
|
| 0% |
Uncovered Elements: 3 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
91 |
0 |
@Override... |
92 |
|
public void mouseExited(MouseEvent evt) |
93 |
|
{ |
94 |
0 |
active = false; |
95 |
0 |
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
96 |
0 |
repaint(); |
97 |
|
} |
98 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 3 |
Complexity Density: 0.38 |
|
99 |
0 |
@Override... |
100 |
|
public void mouseDragged(MouseEvent evt) |
101 |
|
{ |
102 |
0 |
active = true; |
103 |
0 |
Dimension d = ap.idPanel.idCanvas.getSize(); |
104 |
0 |
int dif = evt.getX() - oldX; |
105 |
|
|
106 |
0 |
final int newWidth = d.width + dif; |
107 |
0 |
if (newWidth > 20 || dif > 0) |
108 |
|
{ |
109 |
0 |
ap.setIdWidth(newWidth, d.height); |
110 |
0 |
this.setSize(newWidth, getSize().height); |
111 |
0 |
oldX = evt.getX(); |
112 |
|
} |
113 |
|
} |
114 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
115 |
0 |
@Override... |
116 |
|
public void mouseMoved(MouseEvent evt) |
117 |
|
{ |
118 |
|
} |
119 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
120 |
0 |
@Override... |
121 |
|
public void mouseClicked(MouseEvent evt) |
122 |
|
{ |
123 |
|
} |
124 |
|
} |